fix 修复 手动登出与token过期登出跳转行为不一致问题

This commit is contained in:
疯狂的狮子Li 2024-11-20 11:25:51 +08:00
parent 22e8a57b31
commit 9dd7bf8990

View File

@ -98,6 +98,7 @@ import { getTenantList } from '@/api/login';
import { dynamicClear, dynamicTenant } from '@/api/system/tenant'; import { dynamicClear, dynamicTenant } from '@/api/system/tenant';
import { TenantVO } from '@/api/types'; import { TenantVO } from '@/api/types';
import notice from './notice/index.vue'; import notice from './notice/index.vue';
import router from "@/router";
const appStore = useAppStore(); const appStore = useAppStore();
const userStore = useUserStore(); const userStore = useUserStore();
@ -163,8 +164,14 @@ const logout = async () => {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}); });
await userStore.logout(); userStore.logout().then(() => {
location.href = import.meta.env.VITE_APP_CONTEXT_PATH + 'index'; router.replace({
path: '/login',
query: {
redirect: encodeURIComponent(router.currentRoute.value.fullPath || '/')
}
})
});
}; };
const emits = defineEmits(['setLayout']); const emits = defineEmits(['setLayout']);