Skip to content

Commit

Permalink
show only one toaster message on chekin create
Browse files Browse the repository at this point in the history
  • Loading branch information
kcinay055679 committed Nov 24, 2023
1 parent 05c99c3 commit b0c359a
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import { TranslateService } from '@ngx-translate/core';

@Injectable()
export class ErrorInterceptor implements HttpInterceptor {
NO_ERROR_TOASTER_ROUTES = ['/token'];
NO_TOASTER_ROUTES = ['/token'];
NO_TOASTER_SUCCESS_ROUTES = ['/action'];

constructor(
private router: Router,
Expand All @@ -31,7 +32,7 @@ export class ErrorInterceptor implements HttpInterceptor {
}

handleErrorToaster(response: any) {
if (this.NO_ERROR_TOASTER_ROUTES.some((route) => response.url.includes(route))) {
if (this.NO_TOASTER_ROUTES.some((route) => response.url.includes(route))) {
return;
}

Expand All @@ -54,7 +55,8 @@ export class ErrorInterceptor implements HttpInterceptor {
}

handleSuccess(response: any, method: string) {
if (this.NO_ERROR_TOASTER_ROUTES.some((route) => response.url.includes(route))) {
const NO_TOASTER = this.NO_TOASTER_ROUTES.concat(this.NO_TOASTER_SUCCESS_ROUTES);
if (NO_TOASTER.some((route) => response.url.includes(route))) {
return;
}
switch (method) {
Expand Down

0 comments on commit b0c359a

Please sign in to comment.