Created
March 30, 2020 17:06
-
-
Save Porter97/79d1b3dd46a571f38c47f5f1afaa0ac5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const defaultState = { | |
appName: 'Offbrand' | |
}; | |
export default (state = defaultState, action) => { | |
switch(action.type) { | |
case 'APP_LOAD': | |
return { | |
...state, | |
appLoaded: true, | |
currentUser: action.payload ? action.payload.user : null | |
}; | |
case 'REDIRECT': | |
return {...state, redirectTo: null}; | |
case 'REGISTER': | |
return { | |
...state, | |
redirectTo: action.error ? null : '/', | |
currentUser: action.error ? null : action.payload.user, | |
}; | |
default: | |
return state; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment