account.store.ts 482 B

123456789101112131415161718
  1. import { defineStore } from 'pinia';
  2. import type { AccountModel } from '@model/account.model.ts';
  3. import { defaultMenus } from '@/router/menu.ts';
  4. export const useAccountStore = defineStore('account', () => {
  5. const token = ref<string>();
  6. const account = shallowRef<AccountModel>();
  7. const menus = shallowRef(defaultMenus);
  8. function $reset() {
  9. token.value = void 0;
  10. account.value = void 0;
  11. menus.value = [];
  12. }
  13. return { token, account, menus, $reset };
  14. });