fix(ui): ts类型

This commit is contained in:
廖彦棋
2024-03-06 18:20:07 +08:00
parent d4a24a0f1d
commit f2cfcfeefc
4 changed files with 17 additions and 5 deletions

View File

@@ -48,8 +48,8 @@ function useAsyncTable<T extends Record<string, unknown>>(
page: paginationState.current,
pageSize: paginationState.pageSize,
});
tableState.data = data?.items;
paginationState.total = data.total;
tableState.data = (data as any)?.items;
paginationState.total = (data as any)?.total;
} finally {
tableState.loading = false
}

View File

@@ -5,12 +5,12 @@ import router from '@/router'
export const useAuthStore = defineStore({
id: __AUTH_KEY,
state: () => ({ token: null }),
state: () => ({ token: null } as { token: string | null }),
actions: {
init() {
this.$state.token = localStorage.getItem(__AUTH_KEY);
},
async login(params) {
async login(params: any) {
try {
const { data } = await userLogin(params)
if (data) {
@@ -29,7 +29,7 @@ export const useAuthStore = defineStore({
await userLogout()
if (this.$state.token) {
localStorage.removeItem(__AUTH_KEY)
this.$restate.token = null
this.$reset()
}
Message.success('退出成功');
router.push({ name: 'Login' })