forked from CSGOWTF/csgowtf
33 lines
617 B
TypeScript
33 lines
617 B
TypeScript
import { defineStore } from "pinia";
|
|
|
|
export type infoState = {
|
|
statusCode: number;
|
|
message: string;
|
|
type: "error" | "success" | "warning";
|
|
};
|
|
|
|
export type RootState = {
|
|
infoState: infoState[];
|
|
infoCount: number;
|
|
};
|
|
|
|
export const useInfoStateStore = defineStore({
|
|
id: "infoState",
|
|
state: () =>
|
|
({
|
|
infoState: [],
|
|
infoCount: 0,
|
|
} as RootState),
|
|
actions: {
|
|
addInfo(payload: infoState) {
|
|
this.infoState.push(payload);
|
|
this.infoCount += 1;
|
|
},
|
|
removeInfo(id: number) {
|
|
this.infoState.splice(id, 1);
|
|
this.infoCount -= 1;
|
|
},
|
|
},
|
|
getters: {},
|
|
});
|