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.ts 1011B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import ReducerRegistry from '../base/redux/ReducerRegistry';
  2. import {
  3. UPDATE_BREAKOUT_ROOMS,
  4. _RESET_BREAKOUT_ROOMS,
  5. _UPDATE_ROOM_COUNTER
  6. } from './actionTypes';
  7. import { FEATURE_KEY } from './constants';
  8. import { IRooms } from './types';
  9. const DEFAULT_STATE = {
  10. rooms: {},
  11. roomCounter: 0
  12. };
  13. export interface IBreakoutRoomsState {
  14. roomCounter: number;
  15. rooms: IRooms;
  16. }
  17. /**
  18. * Listen for actions for the breakout-rooms feature.
  19. */
  20. ReducerRegistry.register<IBreakoutRoomsState>(FEATURE_KEY, (state = DEFAULT_STATE, action): IBreakoutRoomsState => {
  21. switch (action.type) {
  22. case _UPDATE_ROOM_COUNTER:
  23. return {
  24. ...state,
  25. roomCounter: action.roomCounter
  26. };
  27. case UPDATE_BREAKOUT_ROOMS: {
  28. const { roomCounter, rooms } = action;
  29. return {
  30. ...state,
  31. roomCounter,
  32. rooms
  33. };
  34. }
  35. case _RESET_BREAKOUT_ROOMS: {
  36. return DEFAULT_STATE;
  37. }
  38. }
  39. return state;
  40. });