34 lines
989 B
TypeScript
34 lines
989 B
TypeScript
import AppState from "../classes/AppState";
|
|
|
|
export const useAppStore = defineStore("appStore", {
|
|
state: () => ({
|
|
data: new AppState({} as TypeApp),
|
|
activeBrand: null,
|
|
activeRange: null,
|
|
} as {
|
|
data: AppState;
|
|
activeBrand: TypeBrand | null;
|
|
activeRange: TypeRange | null;
|
|
}),
|
|
actions: {
|
|
setupAppData(dataJson: TypeApp): void {
|
|
this.data = new AppState(dataJson);
|
|
},
|
|
setActiveBrand(brand: TypeBrand|null): void {
|
|
this.activeBrand = brand;
|
|
},
|
|
setActiveRange(range: TypeRange|null): void {
|
|
this.activeRange = range;
|
|
},
|
|
// async fetch() {
|
|
// const infos = await $fetch("https://api.nuxt.com/modules/pinia");
|
|
|
|
// this.name = infos.name;
|
|
// this.description = infos.description;
|
|
// }
|
|
}
|
|
});
|
|
|
|
if (import.meta.hot) {
|
|
import.meta.hot.accept(acceptHMRUpdate(useAppStore, import.meta.hot));
|
|
}
|