Skip to content

Commit

Permalink
Fix potential typo in IOverrideSchedule.
Browse files Browse the repository at this point in the history
There are two files referring to a property in IOverrideSchedule but one of them has a typo (which was not caught because of tslint-ignore). I verified the eoutput from API and changed to the correct property returned by the API.
  • Loading branch information
hussainweb committed Nov 25, 2019
1 parent 599fccc commit 138dc93
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
7 changes: 3 additions & 4 deletions client/src/reducers/mealSchedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const INITIAL_STATE : ISubscriptionSchedule = {
SATURDAY:null,
SUNDAY:null
},
overrideSchedules : []
overrideSchedule : []
};

export default function(state = INITIAL_STATE, action: any) {
Expand All @@ -28,10 +28,10 @@ export default function(state = INITIAL_STATE, action: any) {
case GET_SUBSCRIBER_OVERRIDESCHEDULE:
return { ...state, overrideSchedules: action.payload };
case ADD_SUBSCRIBER_OVERRIDESCHEDULE:
let overrideSchedules = state.overrideSchedules as Array<IOverrideSchedule>;
let overrideSchedules = state.overrideSchedule as Array<IOverrideSchedule>;
return { ...state, overrideSchedules: [...overrideSchedules, action.payload] };
case DELETE_SUBSCRIBER_OVERRIDESCHEDULE:
let delOverrideSchedules = state.overrideSchedules as Array<IOverrideSchedule>;
let delOverrideSchedules = state.overrideSchedule as Array<IOverrideSchedule>;
delOverrideSchedules = delOverrideSchedules.filter((schedule:IOverrideSchedule) => schedule.overrideStartDate != action.payload )
return { ...state, overrideSchedules: [ ...delOverrideSchedules] };
case API_USER_ERROR:
Expand All @@ -40,4 +40,3 @@ export default function(state = INITIAL_STATE, action: any) {
return state;
}
}

2 changes: 0 additions & 2 deletions client/src/reducers/mealscheduleAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ export const getSubscriptionSchedule = (subscriberId: string, workFlowProcessor:
if(response && response.data) {
const subscriptionSchedule: ISubscriptionSchedule = response.data;
dispatch({ type: GET_SUBSCRIBER_SCHEDULE , payload: subscriptionSchedule.optedSchedule });
//@ts-ignore
if(subscriptionSchedule && subscriptionSchedule.overrideSchedule && subscriptionSchedule.overrideSchedule[0]) {
//@ts-ignore
dispatch({ type: GET_SUBSCRIBER_OVERRIDESCHEDULE , payload: subscriptionSchedule.overrideSchedule });
}
}
Expand Down
2 changes: 1 addition & 1 deletion client/src/type/Type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export interface ISubscriptionSchedule {
SATURDAY?: string | null;
SUNDAY?: string | null;
}
overrideSchedules ?: Array<IOverrideSchedule> | null;
overrideSchedule ?: Array<IOverrideSchedule> | null;

}

Expand Down

0 comments on commit 138dc93

Please sign in to comment.