You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
462 B
26 lines
462 B
7 months ago
|
import { defineStore } from 'pinia';
|
||
|
import { router } from '/nerv-lib/saas/router';
|
||
|
|
||
|
export const user = defineStore<
|
||
|
string,
|
||
|
{ token: string; userName: string },
|
||
|
{},
|
||
|
{ login: Function; logout: Function }
|
||
|
>({
|
||
|
id: 'user',
|
||
|
state: () => {
|
||
|
return { token: '', userName: '111' };
|
||
|
},
|
||
|
getters: {
|
||
|
double(): string {
|
||
|
return this.userName;
|
||
|
},
|
||
|
},
|
||
|
actions: {
|
||
|
login() {},
|
||
|
logout() {
|
||
|
router.push('/login');
|
||
|
},
|
||
|
},
|
||
|
});
|