Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
const USER_SET = 'USER_SET'
const USER_SET_LOADING = 'USER_SET_LOADING'
const USER_LOGOUT = 'USER_LOGOUT'
const initialState = {
loading: false,
userData: {}
}
export default function user (state = initialState, action = {}) {
switch (action.type) {
case USER_SET:
console.log('USER SET', action)
return Object.assign({}, state, { ...action.payload })
case USER_SET_LOADING:
return { ...state, loading: action.payload };
case USER_LOGOUT:
return {
loading: false,
userData: {}
}
default:
return state
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.