| | |
| | | import type { AuthPermissionInfo, Recordable, UserInfo } from '..\packages\types\src'; |
| | | import type { AuthPermissionInfo, Recordable, UserInfo } from '@vben/types'; |
| | | |
| | | import type { AuthApi } from '#/api'; |
| | | |
| | | import { ref } from 'vue'; |
| | | import { useRouter } from 'vue-router'; |
| | | |
| | | import { LOGIN_PATH } from '..\packages\constants\src'; |
| | | import { preferences } from '..\packages\preferences\src'; |
| | | import { resetAllStores, useAccessStore, useUserStore } from '..\packages\stores\src'; |
| | | import { LOGIN_PATH } from '@vben/constants'; |
| | | import { preferences } from '@vben/preferences'; |
| | | import { resetAllStores, useAccessStore, useUserStore } from '@vben/stores'; |
| | | |
| | | import { notification } from 'ant-design-vue'; |
| | | import { defineStore } from 'pinia'; |
| | |
| | | socialLogin, |
| | | } from '#/api'; |
| | | import { $t } from '#/locales'; |
| | | import { automaticApproval, loadAuditPolicy } from '#/store/audit-policy'; |
| | | |
| | | export const useAuthStore = defineStore('auth', () => { |
| | | const accessStore = useAccessStore(); |
| | |
| | | // oxlint-disable-next-line no-unused-expressions |
| | | onSuccess |
| | | ? await onSuccess?.() |
| | | : await router.push( |
| | | userInfo.homePath || preferences.app.defaultHomePath, |
| | | ); |
| | | : await router.push('/analytics'); |
| | | } |
| | | |
| | | if (userInfo?.nickname) { |
| | |
| | | // eslint-disable-next-line no-useless-assignment |
| | | let authPermissionInfo: AuthPermissionInfo | null = null; |
| | | authPermissionInfo = await getAuthPermissionInfoApi(); |
| | | await loadAuditPolicy(); |
| | | // userStore |
| | | userStore.setUserInfo(authPermissionInfo.user); |
| | | userStore.setUserRoles(authPermissionInfo.roles); |
| | |
| | | |
| | | function $reset() { |
| | | loginLoading.value = false; |
| | | automaticApproval.value = false; |
| | | } |
| | | |
| | | return { |