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 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import {
  2. ReducerRegistry
  3. } from '../base/redux';
  4. import {
  5. UPDATE_DIAL_IN_NUMBERS_FAILED,
  6. UPDATE_DIAL_IN_NUMBERS_REQUEST,
  7. UPDATE_DIAL_IN_NUMBERS_SUCCESS
  8. } from './actionTypes';
  9. const DEFAULT_STATE = {
  10. numbersEnabled: true
  11. };
  12. ReducerRegistry.register(
  13. 'features/invite/dial-in',
  14. (state = DEFAULT_STATE, action) => {
  15. switch (action.type) {
  16. case UPDATE_DIAL_IN_NUMBERS_FAILED: {
  17. return {
  18. ...state,
  19. error: action.error,
  20. loading: false
  21. };
  22. }
  23. case UPDATE_DIAL_IN_NUMBERS_REQUEST: {
  24. return {
  25. ...state,
  26. error: null,
  27. loading: true
  28. };
  29. }
  30. case UPDATE_DIAL_IN_NUMBERS_SUCCESS: {
  31. const { numbers, numbersEnabled } = action.response;
  32. return {
  33. error: null,
  34. loading: false,
  35. numbers,
  36. numbersEnabled
  37. };
  38. }
  39. }
  40. return state;
  41. });