refactor: format
TS Lint / ESLint (push) Has been cancelled
TS Lint / Oxlint (push) Has been cancelled
TS Lint / TypeScript (push) Has been cancelled

This commit is contained in:
2026-07-14 11:47:05 +02:00
parent 566f8403ef
commit a9b2e31d81
17 changed files with 432 additions and 183 deletions
+14 -10
View File
@@ -1,29 +1,33 @@
import { ref } from 'vue';
import { defineStore } from 'pinia';
import type { Alert } from '@/types';
import { ref } from "vue";
import { defineStore } from "pinia";
import type { Alert } from "@/types";
export const useAlertStore = defineStore('alerts', () => {
export const useAlertStore = defineStore("alerts", () => {
const alerts = ref<Alert[]>([]);
function addAlert(message: string, type: 'info' | 'success' | 'warning' | 'error', seconds: number) {
function addAlert(
message: string,
type: "info" | "success" | "warning" | "error",
seconds: number,
) {
alerts.value.push({ message, type, created: new Date(), seconds });
}
function alertSuccess(message: string, seconds = 2) {
addAlert(message, 'success', seconds);
addAlert(message, "success", seconds);
}
function alertInfo(message: string, seconds = 3) {
addAlert(message, 'info', seconds);
addAlert(message, "info", seconds);
}
function alertWarning(message: string, seconds = 4) {
addAlert(message, 'warning', seconds);
addAlert(message, "warning", seconds);
}
function alertError(message: string, seconds = 5) {
addAlert(message, 'error', seconds);
addAlert(message, "error", seconds);
}
return { alerts, alertSuccess, alertInfo, alertWarning, alertError };
})
});