From 127501039ee00eb31afa7409363e87a1f4668b3c Mon Sep 17 00:00:00 2001
From: Alexandru Munteanu <alexandru.munt@gmail.com>
Date: Tue, 10 Apr 2018 12:45:30 +0300
Subject: [PATCH] refactor(author-list): refactor to work with api changes

---
 .../src/components/AuthorList/AuthorEditor.js    | 16 ++--------------
 packages/components-faraday/src/redux/authors.js |  2 +-
 2 files changed, 3 insertions(+), 15 deletions(-)

diff --git a/packages/components-faraday/src/components/AuthorList/AuthorEditor.js b/packages/components-faraday/src/components/AuthorList/AuthorEditor.js
index 53f69eecc..98b088a7c 100644
--- a/packages/components-faraday/src/components/AuthorList/AuthorEditor.js
+++ b/packages/components-faraday/src/components/AuthorList/AuthorEditor.js
@@ -14,14 +14,7 @@ import {
   authorSuccess,
   authorFailure,
 } from '../../redux/authors'
-import { ValidatedTextField } from './FormItems'
-
-const emailRegex = new RegExp(
-  /^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i, //eslint-disable-line
-)
-
-const emailValidator = value =>
-  emailRegex.test(value) ? undefined : 'Invalid email'
+import { ValidatedTextField, Label } from './FormItems'
 
 const renderCheckbox = ({ input }) => (
   <Checkbox checked={input.value} type="checkbox" {...input} />
@@ -79,12 +72,7 @@ const AuthorEdit = ({
     </Row>
 
     <Row>
-      <ValidatedTextField
-        isRequired
-        label="Email*"
-        name="edit.email"
-        validators={[emailValidator]}
-      />
+      <Label label="Email" value={email} />
       <ValidatedTextField
         isRequired
         label="Affiliation*"
diff --git a/packages/components-faraday/src/redux/authors.js b/packages/components-faraday/src/redux/authors.js
index e7767063f..a348f22be 100644
--- a/packages/components-faraday/src/redux/authors.js
+++ b/packages/components-faraday/src/redux/authors.js
@@ -51,7 +51,7 @@ export const getAuthorsTeam = collectionId =>
   )
 
 export const updateAuthorsTeam = (teamId, body) =>
-  update(`/teams/${teamId}s`, body)
+  update(`/teams/${teamId}`, body)
 
 // selectors
 export const getFragmentAuthors = (state, fragmentId) =>
-- 
GitLab