diff --git a/client/src/app/services/actions.service.ts b/client/src/app/services/actions.service.ts index d31d151..84a0483 100644 --- a/client/src/app/services/actions.service.ts +++ b/client/src/app/services/actions.service.ts @@ -28,7 +28,18 @@ export class ActionsService { doAction(action: INotificationAction, notification?: INotification) { if (action.url) { // we never send data here, it's inferred server side - this.http.post(`${environment.apiUrl}/${action.url}`, {}).subscribe(); + this.http + .post(`${environment.apiUrl}/${action.url}`, {}) + .subscribe(() => { + if (!notification) return; + + this.notificationService + .clearActions(notification.id || '') + .subscribe(); + this.store.dispatch( + new ClearNotificationActions(notification.id || ''), + ); + }); } if (action.clearActionsForUrl) { @@ -37,11 +48,6 @@ export class ActionsService { ); } - if (notification) { - this.notificationService.clearActions(notification.id || '').subscribe(); - this.store.dispatch(new ClearNotificationActions(notification.id || '')); - } - if (action.action === 'navigate') { this.router.navigate([action.actionData.url]); }