Commit cccf8d8197a675b10fab0442f56b9456eb9dd98c
1 parent
5450534a
fix: loginOut api
Showing
3 changed files
with
5 additions
and
4 deletions
yudao-ui-admin-vue3/src/api/login/index.ts
| @@ -33,7 +33,7 @@ export const getTenantIdByNameApi = (name: string) => { | @@ -33,7 +33,7 @@ export const getTenantIdByNameApi = (name: string) => { | ||
| 33 | 33 | ||
| 34 | // 登出 | 34 | // 登出 |
| 35 | export const loginOutApi = () => { | 35 | export const loginOutApi = () => { |
| 36 | - return request.delete({ url: '/system/auth/logout' }) | 36 | + return request.post({ url: '/system/auth/logout' }) |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | // 获取用户权限信息 | 39 | // 获取用户权限信息 |
yudao-ui-admin-vue3/src/layout/components/UserInfo/src/UserInfo.vue
| @@ -35,7 +35,7 @@ const loginOut = () => { | @@ -35,7 +35,7 @@ const loginOut = () => { | ||
| 35 | type: 'warning' | 35 | type: 'warning' |
| 36 | }) | 36 | }) |
| 37 | .then(async () => { | 37 | .then(async () => { |
| 38 | - userStore.loginOut() | 38 | + await userStore.loginOut() |
| 39 | tagsViewStore.delAllViews() | 39 | tagsViewStore.delAllViews() |
| 40 | replace('/login?redirect=/index') | 40 | replace('/login?redirect=/index') |
| 41 | }) | 41 | }) |
yudao-ui-admin-vue3/src/store/modules/user.ts
| @@ -2,7 +2,7 @@ import { store } from '../index' | @@ -2,7 +2,7 @@ import { store } from '../index' | ||
| 2 | import { defineStore } from 'pinia' | 2 | import { defineStore } from 'pinia' |
| 3 | import { getAccessToken, removeToken } from '@/utils/auth' | 3 | import { getAccessToken, removeToken } from '@/utils/auth' |
| 4 | import { CACHE_KEY, useCache } from '@/hooks/web/useCache' | 4 | import { CACHE_KEY, useCache } from '@/hooks/web/useCache' |
| 5 | -import { getInfoApi } from '@/api/login' | 5 | +import { getInfoApi, loginOutApi } from '@/api/login' |
| 6 | 6 | ||
| 7 | const { wsCache } = useCache() | 7 | const { wsCache } = useCache() |
| 8 | 8 | ||
| @@ -59,7 +59,8 @@ export const useUserStore = defineStore('admin-user', { | @@ -59,7 +59,8 @@ export const useUserStore = defineStore('admin-user', { | ||
| 59 | this.isSetUser = true | 59 | this.isSetUser = true |
| 60 | wsCache.set(CACHE_KEY.USER, userInfo) | 60 | wsCache.set(CACHE_KEY.USER, userInfo) |
| 61 | }, | 61 | }, |
| 62 | - loginOut() { | 62 | + async loginOut() { |
| 63 | + await loginOutApi() | ||
| 63 | removeToken() | 64 | removeToken() |
| 64 | wsCache.clear() | 65 | wsCache.clear() |
| 65 | this.resetState() | 66 | this.resetState() |