Files
Eventment/app/reducers/auth.js
2019-08-06 01:36:08 -04:00

15 lines
344 B
JavaScript

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;
}
};