import {ActionType} from 'constants';

const initialState = {
  data: undefined,
  userToken: undefined,
};

export default (state = initialState, action) => {
  const newState = {...state};
  switch (action.type) {
    case ActionType.SIGN_IN:
      newState.userToken = action.payload.data;
      return newState;
    case ActionType.SIGN_OUT:
      newState.userToken = undefined;
      return newState;
    default:
      return state;
  }
};
