connected-react-router#LocationChangeAction TypeScript Examples

The following examples show how to use connected-react-router#LocationChangeAction. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: reducers.ts    From msteams-meetings-template with MIT License 6 votes vote down vote up
meetingReducer = (
  state: MeetingState,
  action: MeetingAction | LocationChangeAction<LocationChangePayload>
) => {
  if (!state) return loadInitialState();
  switch (action.type) {
    case SET_MEETING_COMMAND:
      return {
        ...state,
        inputMeeting: _.cloneDeep(action.meeting)
      };
    case CREATE_MEETING_COMMAND:
      return {
        ...state,
        creationInProgress: true
      };
    case MEETING_CREATED_EVENT:
      return {
        ...state,
        createdMeeting: action.meeting
      };
    case LOCATION_CHANGE:
      if (action.payload.location.pathname === '/createMeeting') {
        return {
          ...state,
          creationInProgress: false
        };
      }
    // falls through
    default:
      return state;
  }
}