您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

reducer.js 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import {
  2. ReducerRegistry
  3. } from '../base/redux';
  4. import {
  5. DIAL_OUT_CANCELED,
  6. DIAL_OUT_CODES_UPDATED,
  7. DIAL_OUT_SERVICE_FAILED,
  8. PHONE_NUMBER_CHECKED
  9. } from './actionTypes';
  10. const DEFAULT_STATE = {
  11. dialOutCodes: null,
  12. error: null,
  13. isDialNumberAllowed: true
  14. };
  15. ReducerRegistry.register(
  16. 'features/dial-out',
  17. (state = DEFAULT_STATE, action) => {
  18. switch (action.type) {
  19. case DIAL_OUT_CANCELED: {
  20. return DEFAULT_STATE;
  21. }
  22. case DIAL_OUT_CODES_UPDATED: {
  23. return {
  24. ...state,
  25. error: null,
  26. dialOutCodes: action.response
  27. };
  28. }
  29. case DIAL_OUT_SERVICE_FAILED: {
  30. return {
  31. ...state,
  32. error: action.error
  33. };
  34. }
  35. case PHONE_NUMBER_CHECKED: {
  36. return {
  37. ...state,
  38. error: null,
  39. isDialNumberAllowed: action.response.allow
  40. };
  41. }
  42. }
  43. return state;
  44. });