Skip to content

Commit

Permalink
fix: create event tracker fix
Browse files Browse the repository at this point in the history
  • Loading branch information
9sneha-n committed Oct 17, 2024
1 parent 0d1453c commit 4b0a04e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ export function saveDiseaseOutbreak(
teamMemberRepository: TeamMemberRepository;
roleRepository: RoleRepository;
},
diseaseOutbreakEventBaseAttrs: DiseaseOutbreakEventBaseAttrs
diseaseOutbreakEvent: DiseaseOutbreakEventBaseAttrs
): FutureData<Id> {
return repositories.diseaseOutbreakEventRepository
.save(diseaseOutbreakEventBaseAttrs)
.flatMap(() => {
return saveIncidentManagerTeamMemberRole(repositories, diseaseOutbreakEventBaseAttrs);
.save(diseaseOutbreakEvent)
.flatMap((diseaseOutbreakId: Id) => {
const diseaseOutbreakEventWithId = { ...diseaseOutbreakEvent, id: diseaseOutbreakId };
return saveIncidentManagerTeamMemberRole(repositories, diseaseOutbreakEventWithId);
});
}

Expand Down
27 changes: 13 additions & 14 deletions src/webapp/pages/form-page/useForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ export function useForm(formType: FormType, id?: Id): State {
const currentEventTracker = getCurrentEventTracker();

useEffect(() => {
if (currentEventTrackerState?.id === currentEventTracker?.id) return;
if (currentEventTracker?.id && currentEventTrackerState?.id === currentEventTracker?.id)
return;

compositionRoot.getWithOptions.execute(formType, currentEventTracker, id).run(
formData => {
Expand Down Expand Up @@ -337,20 +338,18 @@ export function useForm(formType: FormType, id?: Id): State {
id: currentEventTracker.id,
});
break;

case "incident-action-plan":
case "incident-response-action":
goTo(RouteName.INCIDENT_ACTION_PLAN, {
id: currentEventTracker.id,
});
break;
default:
switch (formType) {
case "incident-action-plan":
case "incident-response-action":
goTo(RouteName.INCIDENT_ACTION_PLAN, {
id: currentEventTracker.id,
});
break;
default:
goTo(RouteName.EVENT_TRACKER, {
id: currentEventTracker.id,
});
break;
}
goTo(RouteName.EVENT_TRACKER, {
id: currentEventTracker.id,
});
break;
}
} else {
goTo(RouteName.DASHBOARD);
Expand Down

0 comments on commit 4b0a04e

Please sign in to comment.