Advertisement
Guest User

Untitled

a guest
Nov 18th, 2018
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. Login ---reducer---
  2.  
  3. import { LOGIN_SUCCESS, LOGIN_FAILURE } from '../actions/types';
  4.  
  5.  
  6. const initialState = {
  7. message: '',
  8. user: {},
  9. status: "none",
  10. };
  11.  
  12. export default function (state = initialState, action) {
  13. switch (action.type) {
  14. case LOGIN_FAILURE:
  15. return {
  16. ...state,
  17. message: action.payload.errors,
  18. status: "error",
  19. };
  20.  
  21. case LOGIN_SUCCESS:
  22. return {
  23. ...state,
  24. message: action.payload,
  25. status: "loading",
  26. };
  27.  
  28. default:
  29. return state;
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement