master
parent
e654fa6ca8
commit
8f0fc39c60
|
@ -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,
|
||||
})
|
Loading…
Reference in New Issue