Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

reducer.ts 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import ReducerRegistry from '../base/redux/ReducerRegistry';
  2. import {
  3. SET_GOOGLE_API_PROFILE,
  4. SET_GOOGLE_API_STATE
  5. } from './actionTypes';
  6. import { GOOGLE_API_STATES } from './constants';
  7. /**
  8. * The default state is the Google API needs loading.
  9. *
  10. * @type {{googleAPIState: number}}
  11. */
  12. const DEFAULT_STATE = {
  13. googleAPIState: GOOGLE_API_STATES.NEEDS_LOADING,
  14. profileEmail: ''
  15. };
  16. export interface IGoogleApiState {
  17. googleAPIState: number;
  18. googleResponse?: Object;
  19. profileEmail: string;
  20. }
  21. /**
  22. * Reduces the Redux actions of the feature features/google-api.
  23. */
  24. ReducerRegistry.register<IGoogleApiState>('features/google-api',
  25. (state = DEFAULT_STATE, action): IGoogleApiState => {
  26. switch (action.type) {
  27. case SET_GOOGLE_API_STATE:
  28. return {
  29. ...state,
  30. googleAPIState: action.googleAPIState,
  31. googleResponse: action.googleResponse
  32. };
  33. case SET_GOOGLE_API_PROFILE:
  34. return {
  35. ...state,
  36. profileEmail: action.profileEmail
  37. };
  38. }
  39. return state;
  40. });