You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

reducer.js 1011B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /* @flow */
  2. import { assign, ReducerRegistry } from '../base/redux';
  3. import {
  4. CANCEL_LOGIN,
  5. STOP_WAIT_FOR_OWNER,
  6. UPGRADE_ROLE_FINISHED,
  7. UPGRADE_ROLE_STARTED,
  8. WAIT_FOR_OWNER
  9. } from './actionTypes';
  10. ReducerRegistry.register('features/authentication', (state = {}, action) => {
  11. switch (action.type) {
  12. case CANCEL_LOGIN:
  13. return assign(state, {
  14. upgradeRoleError: undefined,
  15. upgradeRoleInProgress: undefined
  16. });
  17. case STOP_WAIT_FOR_OWNER:
  18. return assign(state, {
  19. upgradeRoleError: undefined,
  20. waitForOwnerTimeoutID: undefined
  21. });
  22. case UPGRADE_ROLE_FINISHED:
  23. case UPGRADE_ROLE_STARTED:
  24. return assign(state, {
  25. upgradeRoleError: action.error,
  26. upgradeRoleInProgress: action.thenableWithCancel
  27. });
  28. case WAIT_FOR_OWNER:
  29. return assign(state, {
  30. waitForOwnerTimeoutID: action.waitForOwnerTimeoutID
  31. });
  32. }
  33. return state;
  34. });