This commit is contained in:
wu.jifen
2025-08-27 10:15:15 +08:00
parent 321b799c42
commit 674736c331

View File

@@ -89,15 +89,18 @@ service.interceptors.request.use(
service.interceptors.response.use(
response => {
let res = response.data
// 解密处理 todo 用config.headers['X-Encrypted'] === 'true'判断是否需要解密不一定准确
if (response.config.headers['X-Encrypted'] === 'true') {
// 解密处理
if (
response.config.headers['X-Encrypted'] === 'true' &&
typeof res === 'string'
) {
try {
res = decryptWithPrivateKey(res)
} catch (e) {
logger.error('解密响应失败', e)
}
}
if (typeof res === 'string') {
if (res !== '' && typeof res === 'string') {
res = JSON.parse(res)
}
endLoading()