// import { wsCache } from "@/common/untils/wsCache"
|
import { Message } from "element-ui"
|
import i18n from "@/i18n"
|
const durationTime = 2000
|
|
export function responseHandler(res) {
|
const status = res.data.status.toString()
|
// if (status.toString() === ) {
|
|
// }
|
const message = res.data.message || i18n.t(`businessStatusCode.${status}`)
|
Message({
|
message: message,
|
offset: 70,
|
type: "error",
|
duration: durationTime
|
})
|
}
|
|
export function errorResponseHandler(error) {
|
let msg = ""
|
if (error && error.response && error.response.status) {
|
const status = error.response.status.toString()
|
msg = error.response.message || i18n.t(`statusCode.${status}`)
|
} else if (error.message === "Cancel") {
|
return
|
} else {
|
msg = i18n.t(`statusCode.netErr`)
|
}
|
Message({
|
message: msg,
|
offset: 70,
|
type: "error",
|
duration: durationTime
|
})
|
}
|