| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- import createReducer from '../../utils/createReducer';
- import {
- SET_USER,
- SET_USER_ERROR,
- } from '../../actions/user/userActionConstants';
-
- const initialState = {
- id:"",
- firstName:"",
- lastName:"",
- username:"",
- token:"",
- refreshToken:""
- };
-
- export default createReducer(
- {
- [SET_USER]: setUser,
- [SET_USER_ERROR]: setUserError,
- },
- initialState,
- );
-
- function setUser(state, action) {
- return {
- id:action.payload.id,
- firstName:action.payload.firstName,
- lastName:action.payload.lastName,
- username:action.payload.username,
- token:action.payload.token,
- refreshToken:action.payload.refreshToken,
- };
- }
-
- function setUserError(state, action) {
- return {
- ...state,
- errorMessage: action.payload,
- };
- }
|