|
@@ -1,6 +1,6 @@
|
|
|
import request from './index'
|
|
|
import { getObjValue } from 'js-fast-way'
|
|
|
-import { apiErrorMessage } from '~com/message/index.js'
|
|
|
+import { apiErrorMessage, apiWarningMessage } from '~com/message/index.js'
|
|
|
|
|
|
//封装的请求
|
|
|
export const httpApi = async (obj, message = true) => {
|
|
@@ -53,9 +53,12 @@ const getResData = async (response, error = false) => {
|
|
|
//获取msg消息内容
|
|
|
const getMsgVal = (response) => {
|
|
|
const { code, msg, error_description } = getObjValue(response.data)
|
|
|
- if (code === 404 || code === 500 || code === 504) {
|
|
|
+ if (code === 404) {
|
|
|
apiErrorMessage()
|
|
|
return ''
|
|
|
+ } else if (code === 500 || code === 504) {
|
|
|
+ apiWarningMessage()
|
|
|
+ return ''
|
|
|
} else {
|
|
|
return msg || error_description || '未知错误'
|
|
|
}
|