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 742B

1234567891011121314151617181920212223242526272829303132333435363738
  1. // @flow
  2. import { ReducerRegistry } from '../redux';
  3. import { PersistenceRegistry } from '../storage';
  4. import { UPDATE_DROPBOX_TOKEN } from './actionTypes';
  5. /**
  6. * The default state.
  7. */
  8. const DEFAULT_STATE = {
  9. dropbox: {}
  10. };
  11. /**
  12. * The redux subtree of this feature.
  13. */
  14. const STORE_NAME = 'features/base/oauth';
  15. /**
  16. * Sets up the persistence of the feature {@code oauth}.
  17. */
  18. PersistenceRegistry.register(STORE_NAME);
  19. ReducerRegistry.register('features/base/oauth',
  20. (state = DEFAULT_STATE, action) => {
  21. switch (action.type) {
  22. case UPDATE_DROPBOX_TOKEN:
  23. return {
  24. ...state,
  25. dropbox: {
  26. token: action.token
  27. }
  28. };
  29. default:
  30. return state;
  31. }
  32. });