Skip to content

Commit

Permalink
feat(fulfilment): update fulfilment view when a fulfilment is submitted
Browse files Browse the repository at this point in the history
  • Loading branch information
belsman committed Oct 26, 2024
1 parent 9ba10c5 commit e9d807f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,21 @@ export class FulfillmentEffects {
);
});

fulfillmentSubmitedSuccess$ = createEffect(
() => {
return this.actions$.pipe(
ofType(fulfillmentActions.fulfillmentSubmitSuccess),
tap(() => {
this.appFacade.addNotification({
content: 'fulfillment submitted',
type: ENotificationTypes.Success,
});
})
);
},
{ dispatch: false }
);

constructor(
private readonly router: Router,
private readonly actions$: Actions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,17 @@ const reducer = createReducer<IFulfillmentState>(
}
)
),
on(
fulfillmentActions.fulfillmentSubmitSuccess,
(state, { payload }): IFulfillmentState =>
adapter.updateOne(
{ id: payload.id, changes: payload },
{
...state,
actionStatus: EActionStatus.Succeeded,
}
)
),
on(
fulfillmentActions.fulfillmentUpdateFail,
(state, { error }): IFulfillmentState => ({
Expand Down

0 comments on commit e9d807f

Please sign in to comment.