diff --git a/src/components/Notification.vue b/src/components/Notification.vue index c21f5e3..fb6feb5 100644 --- a/src/components/Notification.vue +++ b/src/components/Notification.vue @@ -1,17 +1,15 @@ @@ -26,16 +24,23 @@ function destroyAlert(index : number) { notes.removeAlert(index) } -function toastClasses(type : string){ - return { - 'bg-danger': type === 'danger', - 'bg-success' : type === 'success', - 'bg-warning' : type === 'warning' - } -} - diff --git a/src/stores/notifications.ts b/src/stores/notifications.ts index 4cddd06..9764e0a 100644 --- a/src/stores/notifications.ts +++ b/src/stores/notifications.ts @@ -3,8 +3,8 @@ import { defineStore, acceptHMRUpdate } from 'pinia' export const useNotifications = defineStore('notifications', { state: () => { return { - /**@type {{type: string, text: string}[]} */ - notifications: new Array<{type: string, text: string}>() + /**@type {{type: string, text: string, randomKey: string}[]} */ + notifications: new Array<{type: string, text: string, randomKey: string}>() } }, diff --git a/src/stores/user.ts b/src/stores/user.ts index a868ae9..736e419 100644 --- a/src/stores/user.ts +++ b/src/stores/user.ts @@ -1,6 +1,8 @@ import { defineStore, storeToRefs } from 'pinia' -import axios, {AxiosResponse, AxiosError} from 'axios' import { useNotifications } from './notifications' +import { getUnixTime } from 'date-fns' +import { AxiosError } from 'axios' +import axios from 'axios' type AuthSuccResult = { notification: { @@ -44,6 +46,7 @@ export const useUser = defineStore('userStore', { notifications.value.push({ type: response.data.notification.type, text: response.data.notification.text, + randomKey: getUnixTime(new Date()).toString() }) return true @@ -54,7 +57,8 @@ export const useUser = defineStore('userStore', { const note = { type: data.notification.type, - text: data.notification.text + text: data.notification.text, + randomKey: getUnixTime(new Date()).toString() } notifications.value.push(note)