import { LOGIN_SUCCESS, SET_AUTH, UNSET_AUTH } from '../constants/actionTypes.js';

export const auth = (state = null, action) => {
  switch (action.type) {
    case LOGIN_SUCCESS:
      return action.payload.token;
    case SET_AUTH:
      return action.payload;
    case UNSET_AUTH:
      return null;
    default:
      return state;
  }
};
