km-web-plugin
Version:
ICE Web Plugin Initializer
49 lines (42 loc) • 1.01 kB
text/typescript
import { useToast } from 'primevue/usetoast';
export const useNotify = () => {
const toast = useToast();
const showSuccess = (message: string) => {
toast.add({
severity: 'success',
summary: 'Success',
detail: message,
life: 3000,
});
};
const showError = (message: string) => {
toast.add({
severity: 'error',
summary: 'Error',
detail: message,
life: 5000,
});
};
const showWarning = (message: string) => {
toast.add({
severity: 'warn',
summary: 'Warning',
detail: message,
life: 4000,
});
};
const showInfo = (message: string) => {
toast.add({
severity: 'info',
summary: 'Info',
detail: message,
life: 3000,
});
};
return {
showSuccess,
showError,
showWarning,
showInfo,
};
};