Commit bf260acd authored by Paul Kaplan's avatar Paul Kaplan

Catch error from user who is already part of studio

parent cb7c60e8
......@@ -8,13 +8,20 @@ import {selectStudioId, setRoles} from '../../../redux/studio';
const Errors = keyMirror({
NETWORK: null,
SERVER: null,
PERMISSION: null
PERMISSION: null,
DUPLICATE: null
});
const normalizeError = (err, body, res) => {
if (err) return Errors.NETWORK;
if (res.statusCode === 401 || res.statusCode === 403) return Errors.PERMISSION;
if (res.statusCode !== 200) return Errors.SERVER;
if (body && body.status === 'error') {
if (body.message.indexOf('already a curator') !== -1) {
return Errors.DUPLICATE;
}
return Errors.UNHANDLED;
}
return null;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment