PM-7392 - ToastService - we need to await the activeToast.onHidden observable so return the activeToast from the showToast.
This commit is contained in:
parent
0ef0bd3f1d
commit
2f414d6f72
|
@ -1,5 +1,5 @@
|
||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
import { IndividualConfig, ToastrService } from "ngx-toastr";
|
import { ActiveToast, IndividualConfig, ToastrService } from "ngx-toastr";
|
||||||
|
|
||||||
import type { ToastComponent } from "./toast.component";
|
import type { ToastComponent } from "./toast.component";
|
||||||
import { calculateToastTimeout } from "./utils";
|
import { calculateToastTimeout } from "./utils";
|
||||||
|
@ -18,7 +18,7 @@ export type ToastOptions = {
|
||||||
export class ToastService {
|
export class ToastService {
|
||||||
constructor(private toastrService: ToastrService) {}
|
constructor(private toastrService: ToastrService) {}
|
||||||
|
|
||||||
showToast(options: ToastOptions) {
|
showToast(options: ToastOptions): ActiveToast<any> {
|
||||||
const toastrConfig: Partial<IndividualConfig> = {
|
const toastrConfig: Partial<IndividualConfig> = {
|
||||||
payload: {
|
payload: {
|
||||||
message: options.message,
|
message: options.message,
|
||||||
|
@ -31,7 +31,7 @@ export class ToastService {
|
||||||
: calculateToastTimeout(options.message),
|
: calculateToastTimeout(options.message),
|
||||||
};
|
};
|
||||||
|
|
||||||
this.toastrService.show(null, options.title, toastrConfig);
|
return this.toastrService.show(null, options.title, toastrConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue