ffplayout/frontend/stores/index.ts

33 lines
815 B
TypeScript
Raw Permalink Normal View History

2023-01-11 04:54:25 -05:00
import { defineStore } from 'pinia'
export const useIndex = defineStore('index', {
state: () => ({
2024-04-06 17:12:06 -04:00
darkMode: false,
2023-01-11 04:54:25 -05:00
showAlert: false,
alertVariant: 'success',
2023-01-11 04:54:25 -05:00
alertMsg: '',
2024-04-25 08:49:57 -04:00
sseConnected: false,
2024-09-03 10:12:29 -04:00
severityLevels: {
DEBUG: 1,
INFO: 2,
WARN: 3,
ERROR: 4,
} as { [key: string]: number }
2023-01-11 04:54:25 -05:00
}),
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 = 'success'
this.alertMsg = ''
}, seconds * 1000)
2023-01-11 04:54:25 -05:00
},
},
})