fix: 修复单点登录跳转失败问题
This commit is contained in:
parent
3c329fd8ad
commit
0cbbd52a1e
|
@ -19,7 +19,9 @@ const filterPath = [ InitHomePath, AccountCenterBindPath ]
|
|||
router.beforeEach((to, from, next) => {
|
||||
// TODO 切换路由取消请求
|
||||
const token = getToken()
|
||||
if (token) {
|
||||
if (to.path === AccountCenterBindPath) {
|
||||
next()
|
||||
} else if (token) {
|
||||
if (to.path === LoginPath) {
|
||||
next({ path: '/' })
|
||||
} else {
|
||||
|
|
|
@ -13,6 +13,8 @@ interface AxiosResponseRewrite<T = any[]> extends AxiosResponse<T, any> {
|
|||
|
||||
export const SUCCESS_CODE = 200 // 成功代码
|
||||
|
||||
const filterApiUrl = ['/system/version', '/system/config/front', '/authorize/captcha/config', '/application/sso/_all', '/authorize/captcha/image']
|
||||
|
||||
export const request = axios.create({
|
||||
withCredentials: false,
|
||||
baseURL: BASE_API_PATH,
|
||||
|
@ -165,7 +167,8 @@ request.interceptors.request.use(config => {
|
|||
// 如果 token 存在
|
||||
// 让每个请求携带自定义 token 请根据实际情况自行修改
|
||||
const token = getToken()
|
||||
if (!token) {
|
||||
const isFilterUrl = filterApiUrl.some(url => config.url.includes(url))
|
||||
if (!token && !isFilterUrl) {
|
||||
setTimeout(() => {
|
||||
cleanToken()
|
||||
router.replace({
|
||||
|
|
|
@ -157,7 +157,7 @@ const token = computed(() => LocalStore.get(TOKEN_KEY));
|
|||
*/
|
||||
const user = ref();
|
||||
const getDetail = () => {
|
||||
if (!token) return;
|
||||
if (!token.value) return;
|
||||
userDetail().then((res: any) => {
|
||||
user.value = res?.result;
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue