21 lines
409 B
TypeScript
21 lines
409 B
TypeScript
import {defineStore} from "pinia";
|
|
import {ref} from "vue";
|
|
|
|
export const useErrorStore = defineStore('error', () => {
|
|
/** @type {(string[])} */
|
|
const errors = ref([] as any[])
|
|
|
|
|
|
function unshift(error: string) {
|
|
console.error('Error:', error);
|
|
errors.value.unshift(error)
|
|
}
|
|
|
|
|
|
function getErrors() {
|
|
return errors
|
|
}
|
|
|
|
return { errors, getErrors, unshift}
|
|
})
|