From f27ca082eb0a839449dd50c49007b58e5ed6946f Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Thu, 19 Jun 2025 19:08:01 +0800
Subject: [PATCH] feat: 服务名修改
---
src/api/http/request.ts | 42 ++++++++++++++++++------------------------
1 files changed, 18 insertions(+), 24 deletions(-)
diff --git a/src/api/http/request.ts b/src/api/http/request.ts
index b7e6fec..9c0e2e8 100644
--- a/src/api/http/request.ts
+++ b/src/api/http/request.ts
@@ -2,7 +2,7 @@
* @Author: GuLiMmo 2820890765@qq.com
* @Date: 2024-03-12 18:01:28
* @LastEditors: GuLiMmo 2820890765@qq.com
- * @LastEditTime: 2024-08-27 16:16:55
+ * @LastEditTime: 2024-08-28 15:03:34
* @FilePath: /drone-web/src/api/http/request.ts
* @Description: axios配置
* Copyright (c) 2024 by GuLiMmo, All Rights Reserved.
@@ -11,7 +11,7 @@
import axios, { AxiosRequestConfig, AxiosResponse } from 'axios'
import { uuidv4 } from '/@/utils/uuid'
import { CURRENT_CONFIG } from './config'
-import { useMyStore } from '/@/store'
+import store from '/@/store/'
import { getToken } from '/@/utils/auth'
import { serialize } from '/@/utils/common'
import { message as Message, MessageArgsProps } from 'ant-design-vue'
@@ -69,7 +69,7 @@
authorization: boolean
}) => {
if (!config.url.includes('/blade-') && !config.url.includes('https://') && !config.url.includes('http://')) {
- config.url = '/drone-yw' + config.url
+ config.url = '/drone-device-core' + config.url
}
const authorization = config.authorization === false
if (!authorization) {
@@ -113,20 +113,13 @@
instance.interceptors.response.use(
(res: { data: { code: any; msg: any; message: any; error_description: any }; status: any; config: { url: string; meta: { noCookie: boolean } } }) => {
const status = res.data.code || res.status
- const statusWhiteList = website.statusWhiteList || []
const message = res.data.msg || res.data.message || res.data.error_description || '未知错误'
- // 如果在白名单里则自行catch逻辑处理
- if ((statusWhiteList as any).includes(status)) return Promise.reject(res)
- // 洪水预警接口地址放开
- const hsyjWhiteList = [
- '/fh-admin/skkr/getFuture',
- 'https://sk.hubeishuiyi.cn/hsybApi/api/fh-admin/skkr/getFuture',
- '/hsybApi/api/fh-admin/skkr/getFuture',
- ]
- if (hsyjWhiteList.includes(res.config.url)) return Promise.resolve(res)
// 如果是401则跳转到登录页面
- const store = useMyStore()
- if (status === 401) store.dispatch('FedLogOut').then(() => router.push({ path: '/login' }))
+ // const store = useMyStore()
+ if (status === 401) {
+ store.dispatch('FedLogOut').then(() => router.push({ path: '/login' }))
+ // return
+ }
// 如果请求为非200否者默认统一处理
if (status !== 200) {
// 排除海康 code 为 0 情况
@@ -201,15 +194,16 @@
// }
if (err.response?.status === 401) {
console.error(err.response)
- const flag: number = Number(localStorage.getItem(ELocalStorageKey.Flag))
- switch (flag) {
- case EUserType.Web:
- router.push(ERouterName.PROJECT_LIST)
- break
- case EUserType.Pilot:
- router.push(ERouterName.PILOT)
- break
- }
+ store.dispatch('FedLogOut').then(() => router.push({ path: '/login' }))
+ // const flag: number = Number(localStorage.getItem(ELocalStorageKey.Flag))
+ // switch (flag) {
+ // case EUserType.Web:
+ // router.push(ERouterName.PROJECT_LIST)
+ // break
+ // case EUserType.Pilot:
+ // router.push(ERouterName.PILOT)
+ // break
+ // }
}
return Promise.reject(err)
},
--
Gitblit v1.9.3