submit
parent
f62148c7f5
commit
acd816b2e3
@ -1,24 +1,20 @@
|
||||
import {uniFetch} from "@/http/main";
|
||||
const fetch = new uniFetch({
|
||||
baseUrl: 'https://warehouse.szjixun.cn',
|
||||
interceptors: {
|
||||
//请求拦截器
|
||||
request(config) {
|
||||
return config
|
||||
},
|
||||
//响应拦截器
|
||||
response(response) {
|
||||
if (response.data?.status === 401) {
|
||||
let curPage = getCurrentPages();
|
||||
let route = curPage[curPage.length - 1].route; //获取当前页面的路由
|
||||
if (route !== "pages/login/login") {
|
||||
uni.navigateTo({
|
||||
url: "/pages/login/login",
|
||||
});
|
||||
}
|
||||
requestInterceptor:(config)=>{
|
||||
return config
|
||||
},
|
||||
responseInterceptor:(response)=>{
|
||||
if (response.data?.status === 401) {
|
||||
let curPage = getCurrentPages();
|
||||
let route = curPage[curPage.length - 1].route; //获取当前页面的路由
|
||||
if (route !== "pages/login/index") {
|
||||
uni.navigateTo({
|
||||
url: "/pages/login/index",
|
||||
});
|
||||
}
|
||||
return response
|
||||
}
|
||||
return response
|
||||
}
|
||||
})
|
||||
export default fetch
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 477 KiB |
Loading…
Reference in New Issue