Removed http error codes
This commit is contained in:
parent
6d9d4f4b24
commit
aebdfd0f2e
@ -1,3 +1 @@
|
|||||||
export const CONFLICT = 409;
|
|
||||||
export const BAD_REQUEST = 400;
|
|
||||||
export const CHANGED_CHECK_INTERVAL = 3000;
|
export const CHANGED_CHECK_INTERVAL = 3000;
|
||||||
|
|||||||
@ -3,10 +3,9 @@ import { ActiveToast, ToastrService } from 'ngx-toastr';
|
|||||||
import { IndividualConfig } from 'ngx-toastr/toastr/toastr-config';
|
import { IndividualConfig } from 'ngx-toastr/toastr/toastr-config';
|
||||||
import { NavigationStart, Router } from '@angular/router';
|
import { NavigationStart, Router } from '@angular/router';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { HttpErrorResponse } from '@angular/common/http';
|
import { HttpErrorResponse, HttpStatusCode } from '@angular/common/http';
|
||||||
import { filter } from 'rxjs/operators';
|
import { filter } from 'rxjs/operators';
|
||||||
import { ErrorMessageService } from './error-message.service';
|
import { ErrorMessageService } from './error-message.service';
|
||||||
import { CONFLICT } from './constants';
|
|
||||||
|
|
||||||
const enum NotificationType {
|
const enum NotificationType {
|
||||||
SUCCESS = 'SUCCESS',
|
SUCCESS = 'SUCCESS',
|
||||||
@ -53,7 +52,7 @@ export class Toaster {
|
|||||||
|
|
||||||
error(message: string, options?: Partial<ErrorToasterOptions>): ActiveToast<unknown> {
|
error(message: string, options?: Partial<ErrorToasterOptions>): ActiveToast<unknown> {
|
||||||
let resultedMsg;
|
let resultedMsg;
|
||||||
if (options?.error && options.error.status !== CONFLICT) {
|
if (options?.error && options.error.status !== HttpStatusCode.Conflict) {
|
||||||
resultedMsg = this._errorMessageService.getMessage(options.error, message);
|
resultedMsg = this._errorMessageService.getMessage(options.error, message);
|
||||||
} else {
|
} else {
|
||||||
resultedMsg = this._translateService.instant(message, options?.params) as string;
|
resultedMsg = this._translateService.instant(message, options?.params) as string;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user