Added Pinia in addition to Vuex for state-management. Will migrate to Pinia eventually

This commit is contained in:
Matthew Aaron Raymer
2022-12-01 17:43:43 +08:00
parent ba143dfccd
commit 3c388da22d
4 changed files with 91 additions and 1 deletions

View File

@@ -1,3 +1,4 @@
import { createPinia } from "pinia";
import { createApp } from "vue";
import App from "./App.vue";
import "./registerServiceWorker";
@@ -50,5 +51,6 @@ import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
createApp(App)
.component("fa", FontAwesomeIcon)
.use(store)
.use(createPinia())
.use(router)
.mount("#app");

19
src/store/account.ts Normal file
View File

@@ -0,0 +1,19 @@
// @ts-check
import { defineStore } from "pinia";
export const useAccountStore = defineStore({
id: "account",
state: () => ({
firstName: "",
lastName: "",
}),
actions: {
reset() {
this.$patch({
firstName: "",
lastName: "",
});
},
},
});