cyywl_server/yudao-ui-app/util/request/responseInterceptors.js

17 lines
457 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/**
* 响应拦截
* @param {Object} http
*/
module.exports = (vm) => {
uni.$u.http.interceptors.response.use((res) => {
/* 对响应成功做点什么 可使用async await 做异步操作*/
const data = res.data
/*
可以根据业务情况做相应的处理
*/
return res
}, (err) => {
/* 对响应错误做点什么 statusCode !== 200*/
return Promise.reject(err)
})
}