RED-8226: added support for raw toastr messages.
This commit is contained in:
parent
a2d30f0a65
commit
94e0021ed4
@ -26,6 +26,7 @@ export interface ToasterOptions extends IndividualConfig {
|
||||
*/
|
||||
readonly params?: Record<string, string | number>;
|
||||
readonly actions?: ToasterActions[];
|
||||
readonly useRaw?: boolean;
|
||||
}
|
||||
|
||||
export interface ErrorToasterOptions extends ToasterOptions {
|
||||
@ -86,16 +87,16 @@ export class Toaster {
|
||||
notificationType = NotificationType.INFO,
|
||||
options?: Partial<ToasterOptions>,
|
||||
): ActiveToast<unknown> {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user