Created
December 9, 2018 16:43
-
-
Save ilonacodes/165837b6c1ed62e82cb312aacbafc9df 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
import {t} from './actions'; | |
// starting with no data | |
const initState = { | |
user: null | |
}; | |
export const userReducer = (state = initState, action) => { | |
switch (action.type) { | |
// tells the store that the user data is successfully retreived | |
// and no longer in the process of fetching another one on user request. | |
case t.LOAD_USER_DATA_SUCCESS: | |
return { | |
...state, | |
user: action.data | |
}; | |
default: | |
return state; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment