2022-09-06 12:03:37 +00:00
|
|
|
import ToastEventBus from 'primevue/toasteventbus';
|
2022-09-14 11:26:01 +00:00
|
|
|
import { PrimeVueToastSymbol } from 'primevue/usetoast';
|
2022-09-06 12:03:37 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
install: (app) => {
|
|
|
|
const ToastService = {
|
|
|
|
add: (message) => {
|
|
|
|
ToastEventBus.emit('add', message);
|
|
|
|
},
|
2023-10-05 12:54:37 +00:00
|
|
|
remove: (message) => {
|
|
|
|
ToastEventBus.emit('remove', message);
|
|
|
|
},
|
2022-09-06 12:03:37 +00:00
|
|
|
removeGroup: (group) => {
|
|
|
|
ToastEventBus.emit('remove-group', group);
|
|
|
|
},
|
|
|
|
removeAllGroups: () => {
|
|
|
|
ToastEventBus.emit('remove-all-groups');
|
|
|
|
}
|
|
|
|
};
|
2022-09-14 11:26:01 +00:00
|
|
|
|
2022-09-06 12:03:37 +00:00
|
|
|
app.config.globalProperties.$toast = ToastService;
|
|
|
|
app.provide(PrimeVueToastSymbol, ToastService);
|
|
|
|
}
|
2022-09-14 11:26:01 +00:00
|
|
|
};
|