diff --git a/src/common/util/errors.js b/src/common/util/errors.js index adc104f..73a4644 100644 --- a/src/common/util/errors.js +++ b/src/common/util/errors.js @@ -53,39 +53,6 @@ const getSignupMessageFromError = (json) => { } }; -const getCreatePostError = (json) => { - switch (json.message) { - case 'ERROR_REQUEST_INVALID_DATA': { - switch (json.errors[0].param) { - case 'title': { - return 'Invalid title. Must be between 3 and 32 characters.'; - } - case 'body': { - return 'Invalid content. Must be between 3 and 1000 characters'; - } - case 'channel': { - return 'Invalid channel. Something went wrong.'; - } - default: { - return 'Invalid value sent to server. Something went wrong.'; - } - } - } - - case 'ERROR_CATEGORY_NOT_FOUND': { - return 'The channel you tried to post to no longer exists.'; - } - - case 'ERROR_ACCESS_DENIED': { - return 'You are not allowed to perform this action.' - } - - default: { - return 'Unknown error. Something went wrong.'; - } - } -}; - const getCreateChannelError = (json) => { switch (json.message) { case 'ERROR_REQUEST_INVALID_DATA': { @@ -112,4 +79,4 @@ const getCreateChannelError = (json) => { const couldNotReach = "Whoops! We couldn't reach the server."; -module.exports = { couldNotReach, getLoginMessageFromError, getSignupMessageFromError, getCreatePostError, getCreateChannelError } \ No newline at end of file +module.exports = { couldNotReach, getLoginMessageFromError, getSignupMessageFromError, getCreateChannelError } \ No newline at end of file