diff --git a/stores/user.js b/stores/user.js new file mode 100644 index 0000000..f856e0e --- /dev/null +++ b/stores/user.js @@ -0,0 +1,24 @@ +// stores/counter.js +import { defineStore } from 'pinia' + +export const useCounterStore = defineStore('user', { + state: () => { + return { + user:{}, + is_login:false + } + }, + // could also be defined as + // state: () => ({ count: 0 }) + actions: { + login(user) { + this.user=user; + this.is_login=true; + }, + logout(){ + this.user={} + this.is_login=false; + } + }, + persist: true, +}) \ No newline at end of file