1234567891011121314151617181920212223242526272829 |
- module.exports = (vm) => {
- uni.$u.http.interceptors.response.use((response) => {
- const data = response.data
-
- const custom = response.config?.custom
- if (data.code == 200) {
- return res;
- } else if (data.code == 401) {
- uni.showToast({
- title: 'Token失效',
- icon: 'none',
- duration: 2000
- })
- } else {
- uni.showToast({
- title: data.msg,
- icon: 'none',
- duration: 2000
- })
- }
- return data.data || {}
- }, (response) => {
- return Promise.reject(response)
- })
- }
|