diff --git a/z_ele/src/layout/components/header-user.vue b/z_ele/src/layout/components/header-user.vue index 3e805b1..ab580bd 100644 --- a/z_ele/src/layout/components/header-user.vue +++ b/z_ele/src/layout/components/header-user.vue @@ -62,6 +62,7 @@ import { useUserStore } from '@/store/modules/user'; import { logout } from '@/utils/common'; import PasswordModal from './password-modal.vue'; + import {userLogout} from "@/api/layout"; const { t } = useI18n(); const { push } = useRouter(); @@ -86,7 +87,8 @@ t('layout.logout.title'), { type: 'warning', draggable: true } ) - .then(() => { + .then(async () => { + await userLogout(); logout(false); }) .catch(() => {}); diff --git a/z_ele/src/utils/common.ts b/z_ele/src/utils/common.ts index f1ffcc7..1087900 100644 --- a/z_ele/src/utils/common.ts +++ b/z_ele/src/utils/common.ts @@ -10,12 +10,11 @@ import { userLogout } from '@/api/layout'; * @param from 登录后跳转的地址 * @param push 路由跳转方法 */ -export async function logout( +export function logout( route?: boolean, from?: string, push?: Router['push'] ) { - await userLogout(); removeToken(); if (route && push) { push({