ffplayout/stores/index.ts
2024-04-06 23:12:06 +02:00

26 lines
648 B
TypeScript

import { defineStore } from 'pinia'
export const useIndex = defineStore('index', {
state: () => ({
darkMode: false,
showAlert: false,
alertVariant: 'alert-success',
alertMsg: '',
}),
getters: {},
actions: {
msgAlert(variance: string, text: string, seconds: number = 3) {
this.alertVariant = variance
this.alertMsg = text
this.showAlert = true
setTimeout(() => {
this.showAlert = false
this.alertVariant = 'alert-success'
this.alertMsg = ''
}, seconds * 1000);
},
},
})