toastservice.ts
unknown
typescript
2 years ago
652 B
11
Indexable
import { useToast } from "primevue/usetoast";
export default class ToastService {
public toast = useToast();
private severity: string;
private summary: string;
makeToast($success: boolean, $message: string, $detail: string = "") {
if ($success)
this.severity = 'success';
else
this.severity = 'error';
if ($message === "OK")
this.summary = 'Success!';
else
this.summary = $message;
this.toast.add({
severity: this.severity,
summary: this.summary,
detail: $detail,
life: 3000,
});
}
}
Editor is loading...