xingyu преди 2 години
родител
ревизия
cccf8d8197

+ 1 - 1
yudao-ui-admin-vue3/src/api/login/index.ts

@@ -33,7 +33,7 @@ export const getTenantIdByNameApi = (name: string) => {
 
 // 登出
 export const loginOutApi = () => {
-  return request.delete({ url: '/system/auth/logout' })
+  return request.post({ url: '/system/auth/logout' })
 }
 
 // 获取用户权限信息

+ 1 - 1
yudao-ui-admin-vue3/src/layout/components/UserInfo/src/UserInfo.vue

@@ -35,7 +35,7 @@ const loginOut = () => {
     type: 'warning'
   })
     .then(async () => {
-      userStore.loginOut()
+      await userStore.loginOut()
       tagsViewStore.delAllViews()
       replace('/login?redirect=/index')
     })

+ 3 - 2
yudao-ui-admin-vue3/src/store/modules/user.ts

@@ -2,7 +2,7 @@ import { store } from '../index'
 import { defineStore } from 'pinia'
 import { getAccessToken, removeToken } from '@/utils/auth'
 import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
-import { getInfoApi } from '@/api/login'
+import { getInfoApi, loginOutApi } from '@/api/login'
 
 const { wsCache } = useCache()
 
@@ -59,7 +59,8 @@ export const useUserStore = defineStore('admin-user', {
       this.isSetUser = true
       wsCache.set(CACHE_KEY.USER, userInfo)
     },
-    loginOut() {
+    async loginOut() {
+      await loginOutApi()
       removeToken()
       wsCache.clear()
       this.resetState()