From 94e0021ed4ec080aec24cf0e963321299513e890 Mon Sep 17 00:00:00 2001 From: Nicoleta Panaghiu Date: Wed, 28 Feb 2024 12:56:39 +0200 Subject: [PATCH] RED-8226: added support for raw toastr messages. --- src/lib/services/toaster.service.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lib/services/toaster.service.ts b/src/lib/services/toaster.service.ts index bd22d05..75d44fb 100644 --- a/src/lib/services/toaster.service.ts +++ b/src/lib/services/toaster.service.ts @@ -26,6 +26,7 @@ export interface ToasterOptions extends IndividualConfig { */ readonly params?: Record; readonly actions?: ToasterActions[]; + readonly useRaw?: boolean; } export interface ErrorToasterOptions extends ToasterOptions { @@ -86,16 +87,16 @@ export class Toaster { notificationType = NotificationType.INFO, options?: Partial, ): ActiveToast { - const translatedMsg = this._translateService.instant(message, options?.params) as string; + const msg = options?.useRaw ? message : (this._translateService.instant(message, options?.params) as string); switch (notificationType) { case NotificationType.SUCCESS: - return this._toastr.success(translatedMsg, options?.title, options); + return this._toastr.success(msg, options?.title, options); case NotificationType.WARNING: - return this._toastr.warning(translatedMsg, options?.title, options); + return this._toastr.warning(msg, options?.title, options); case NotificationType.INFO: default: - return this._toastr.info(translatedMsg, options?.title, options); + return this._toastr.info(msg, options?.title, options); } } }