Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //actions
- export const TimesheetActions = {
- timesheetRequestAction,
- timesheetSuccessAction,
- timesheetFailureAction,
- };
- const actions = union(TimesheetActions);
- export type ActionsUnion = typeof actions;
- //reducer
- export function laborReducer(state = initialState, action: ActionsUnion): State {
- switch(action.type) {
- case TimesheetActions.timesheetRequestAction.type:
- return {
- ...state,
- error: null,
- isLoading: true
- };
- case TimesheetActions.timesheetSuccessAction.type:
- return {
- ...state,
- timesheet: action.timesheet,
- error: null,
- isLoading: false,
- pulledToRefresh: false,
- activeMode: state.activeMode === ActiveMode.WeeklyExpanded ? ActiveMode.Weekly : state.activeMode
- };
- default: {
- return state;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement