const errorReducer = (state = {}, action) => {
  switch (action.type) {
    case 'SIGN_IN_ERROR':
      return {
        message: action.message,
        redirect: {
          yes: false,
          to: null
        },
        errored: true
      };
    case 'SIGN_IN_SUCCESS':
      return {
        message: null,
        redirect: {
          yes: true,
          to: '/messageboard'
        },
        errored: false
      };
    case 'SIGN_UP_ERROR':
      return {
        message: action.message,
        redirect: {
          yes: false,
          to: null
        },
        errored: true
      };
    case 'ADD_MEMBER_ERROR':
      return Object.assign({}, state, {
        message: action.message,
        redirect: {
          yes: false,
          to: null
        },
        errored: true
      });
    case 'ADD_MEMBER_SUCCESS':
      return Object.assign({}, state, {
        message: action.message,
        redirect: {
          yes: false,
          to: null
        },
        errored: false
      });
    case 'DELETE_MEMBER_ERROR':
      return Object.assign({}, state, {
        message: action.message,
        redirect: {
          yes: false,
          to: null
        },
        errored: true
      });
    case 'DELETE_MEMBER_SUCCESS':
      return Object.assign({}, state, {
        message: action.message,
        redirect: {
          yes: false,
          to: null
        },
        errored: false
      });
    case 'DELETE_A_GROUP_SUCCESS':
      return Object.assign({}, state, {
        message: action.message,
        redirect: {
          yes: true,
          to: '/messageboard'
        },
        errored: false
      });
    case 'GET_GROUP_MEMBERS_ERROR':
      return Object.assign({}, state, {
        message: action.message,
        redirect: {
          yes: false,
          to: null
        },
        errored: true
      });
    case 'GET_GROUP_MEMBERS_SUCCESS':
      return Object.assign({}, state, {
        message: action.message,
        redirect: {
          yes: false,
          to: null
        },
        errored: false
      });
    case 'GET_ALL_GROUPS_ERROR':
      return Object.assign({}, state, {
        message: action.message,
        redirect: {
          yes: false,
          to: null
        },
        errored: true
      });
    case 'GET_ALL_GROUPS_SUCCESS':
      return Object.assign({}, state, {
        message: action.message,
        redirect: {
          yes: false,
          to: null
        },
        errored: false
      });
    case 'POST_MESSAGE_ERROR':
      return Object.assign({}, state, {
        message: action.message,
        redirect: {
          yes: false,
          to: null
        },
        errored: true
      });
    case 'POST_MESSAGE_SUCCESS':
      return Object.assign({}, state, {
        message: action.message,
        redirect: {
          yes: false,
          to: null
        },
        errored: false
      });
    case 'GET_MESSAGES_ERROR':
      return Object.assign({}, state, {
        message: action.message,
        redirect: {
          yes: true,
          to: '/messageboard'
        },
        errored: true
      });
    case 'INVALID_AUTH':
      return Object.assign({}, state, {
        message: action.message,
        redirect: {
          yes: true,
          to: '/'
        }
      });
    case 'CREATE_GROUP_ERROR':
      return Object.assign({}, state, {
        message: action.message,
        redirect: {
          yes: false,
          to: null
        },
        errored: true
      });
    case 'CREATE_GROUP_SUCCESS':
      return Object.assign({}, state, {
        message: action.message,
        redirect: {
          yes: true,
          to: '/postmessage'
        },
        errored: false
      });
    case 'GET_MESSAGES_SUCCESS':
      return Object.assign({}, state, {
        message: action.message,
        redirect: {
          yes: false,
          to: null
        },
        errored: false
      });
    case 'RESET_ERROR_LOG':
      return Object.assign({}, state, {
        message: null,
        redirect: {
          yes: false,
          to: null
        },
        errored: false
      });
    case 'LOAD_MESSAGES':
      return Object.assign({}, state, {
        message: null,
        redirect: {
          yes: true,
          to: '/postmessage'
        }
      });
    case 'RESET_REDIRECT_STATE':
      return Object.assign({}, state, {
        message: null,
        redirect: {
          yes: false,
          to: null
        },
        errored: false
      });
    case 'VERIFY_TOKEN_ERROR':
      return Object.assign({}, state, {
        message: 'You have been away for a while. Please sign in again',
        redirect: {
          yes: true,
          to: '/'
        }
      });
    case 'GET_ALL_GROUPS_FOR_A_USER_ERROR':
      return Object.assign({}, state, {
        redirect: {
          yes: true,
          to: '/'
        }
      });
    default:
      return state;
  }
};

export default errorReducer;

@@ -357,32 +357,34 @@
           to: '/
+#/
 messageboard'%0A  
@@ -373,32 +373,32 @@
 #/messageboard'%0A
-
         %7D,%0A     
@@ -1029,24 +1029,30 @@
 ase 'DELETE_
+GROUP_
 MEMBER_ERROR
@@ -1248,16 +1248,22 @@
 'DELETE_
+GROUP_
 MEMBER_S
@@ -1606,32 +1606,34 @@
           to: '/
+#/
 messageboard'%0A  
@@ -3106,16 +3106,18 @@
   to: '/
+#/
 messageb
@@ -3703,33 +3703,35 @@
 ,%0A          to: 
-'
+%60/#
 /postmessage'%0A  
@@ -3718,33 +3718,64 @@
  %60/#/postmessage
-'
+/$%7Baction.data.createdGroup.id%7D%60
 %0A        %7D,%0A    
@@ -4354,17 +4354,19 @@
     to: 
-'
+%60/#
 /postmes
@@ -4369,17 +4369,35 @@
 tmessage
-'
+/$%7Baction.groupId%7D%60
 %0A       

set routes to hash routes