import * as types from "../../../constants"; import initialState from './../../initialState'; export default function signIn(state = initialState.signIn, {type, payload: user, error}) { switch (type) { case types.SIGN_IN_REQUEST: { return { ...state, isFetching: true } } case types.SIGN_IN_REQUEST_SUCCESS: { return { ...state, user, isFetching: false } } case types.SIGN_IN_REQUEST_FAILURE: { return { ...state, error, isFetching: false } } case types.USER_IS_SIGNED_IN: { return { ...state, user } } case types.USER_IS_NOT_SIGNED_IN: { return { ...state, user: null } } default: { return state } } }