blob: ed57f8af75f233c922fd3dcb9198b1d40410aed7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
type NotificationType = 'success' | 'warning' | 'info' | 'error';
export interface Notification {
title: string;
text: string;
type: NotificationType;
}
interface NotificationsStoreState {
notifications: Notification[];
}
/**
* This notification module is meant to host the list of notifications that have been fired while the application was
* not focused.
* This list is then used by the [NotificationButton] component to display notifications to user.
**/
export const notificationsModule = {
state: () => ({
notifications: []
}) as NotificationsStoreState,
mutations: {
addNotification(state: NotificationsStoreState, payload: Notification) {
state.notifications.push(payload);
},
removeNotification(state: NotificationsStoreState, index: number): void {
state.notifications.splice(index, 1);
}
}
}
|