name the stores

This commit is contained in:
2025-07-25 01:19:05 +02:00
parent d08290ce3d
commit b2e9c1f056
2 changed files with 8 additions and 3 deletions

View File

@@ -1,14 +1,15 @@
import { create } from "zustand";
import Flatastic from "@/api/flatastic";
import type { FlatasticChore } from "@/types/flatasticChore";
import { devtools } from "zustand/middleware";
interface FlatasticStore {
chores: FlatasticChore[];
fetch: () => Promise<void>;
}
const useFlatasticStore = create<FlatasticStore>(
(set: (state: Partial<FlatasticStore>) => void) => ({
const useFlatasticStore = create(
devtools((set) => ({
chores: [],
fetch: async () => {
if (!import.meta.env.VITE_FLATTASTIC_API_KEY) {
@@ -20,6 +21,8 @@ const useFlatasticStore = create<FlatasticStore>(
console.log("Flatastic chores fetched:", data);
set({ chores: data as FlatasticChore[] });
},
}), {
name: "flatastic-store",
}),
);

View File

@@ -25,7 +25,9 @@ const useKVVStore = create(
pStreet: pStreetJson as DepartureType[],
});
},
})),
}), {
name: "kvv-store",
}),
);
export { useKVVStore };