修复:后台注册审核接口与退出流程

This commit is contained in:
2026-10-10 16:08:46 +08:00
parent 297af45fea
commit e7de04717a
14 changed files with 292 additions and 68 deletions
@@ -89,6 +89,7 @@ import { adminAuthApi } from '@/api/admin'
import { usePermission } from '@/utils/permission'
import { runWithGlobalLoading } from '@/utils/action-loading'
import { notifyShopThemeChanged } from '@/utils/shop-theme'
import { completeAdminLogout } from '@/utils/admin-logout'
import {
getAdminCurrentShopName,
getAdminRoleLabel,
@@ -102,7 +103,7 @@ import {
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
const { userPermissions, loadUserPermissions, clearPermissions } = usePermission()
const { userPermissions, loadUserPermissions } = usePermission()
/** userInfo is a reactive state variable used by the template and event handlers. */
const userInfo = ref(loadCachedAdminUserInfo())
@@ -188,20 +189,8 @@ const handleLogout = () => {
cancelText: '取消',
onOk: async () => {
await runWithGlobalLoading(async () => {
try {
await adminAuthApi.logout()
} catch (error) {
console.error('退出失败:', error)
} finally {
localStorage.removeItem('adminAccessToken')
localStorage.removeItem('adminRefreshToken')
localStorage.removeItem('adminUserInfo')
localStorage.removeItem('userPermissions')
sessionStorage.removeItem('adminAccessToken')
clearPermissions()
message.success('已退出登录')
window.location.href = '/admin/login'
}
await completeAdminLogout(router)
message.success('已退出登录')
})
}
})