fix pinia store

This commit is contained in:
Julien Calixte
2022-02-27 22:53:20 +01:00
parent b2b3003652
commit 10d8be5f53
3 changed files with 9 additions and 3 deletions

View File

@@ -1,8 +1,8 @@
import { pinia } from "@/store/store";
import { defineApp } from "iles"; import { defineApp } from "iles";
import { createPinia } from "pinia";
export default defineApp({ export default defineApp({
enhanceApp({ app }) { enhanceApp({ app }) {
app.use(createPinia()); app.use(pinia);
}, },
}); });

View File

@@ -1,3 +1,4 @@
import { pinia } from "@/store/store";
import { defineStore } from "pinia"; import { defineStore } from "pinia";
interface Step { interface Step {
@@ -20,7 +21,7 @@ const initialState: State = {
], ],
}; };
export const useProductionFlow = defineStore("production-flow", { const useStore = defineStore("production-flow", {
state: () => ({ ...initialState }), state: () => ({ ...initialState }),
actions: { actions: {
addStep(step: Step) { addStep(step: Step) {
@@ -28,3 +29,5 @@ export const useProductionFlow = defineStore("production-flow", {
}, },
}, },
}); });
export const useProductionFlow = () => useStore(pinia);

3
src/store/store.ts Normal file
View File

@@ -0,0 +1,3 @@
import { createPinia } from "pinia";
export const pinia = createPinia();