|
|
|
@ -27,8 +27,6 @@ service.interceptors.response.use( |
|
|
|
|
if(error.response && error.response.status == 404){ |
|
|
|
|
router.push('/blank.vue') |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Promise.reject(error.response) |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
@ -48,8 +46,6 @@ if(tokens){ |
|
|
|
|
}else{ |
|
|
|
|
token = sessionStorage.getItem('token') |
|
|
|
|
} |
|
|
|
|
console.log(token) |
|
|
|
|
// let token = sessionStorage.getItem('token')
|
|
|
|
|
export function get(url, params = {}) { |
|
|
|
|
// params.t = new Date().getTime(); //get方法加一个时间参数,解决ie下可能缓存问题.
|
|
|
|
|
return service({ |
|
|
|
@ -61,8 +57,6 @@ export function get(url, params = {}) { |
|
|
|
|
params |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//封装post请求
|
|
|
|
|
export function post(url, data = {}) { |
|
|
|
|
//默认配置
|
|
|
|
@ -78,7 +72,6 @@ export function post(url, data = {}) { |
|
|
|
|
sendObject.data=JSON.stringify(data); |
|
|
|
|
return service(sendObject) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//封装put方法 (resfulAPI常用)
|
|
|
|
|
export function put(url,data = {}){ |
|
|
|
|
return service({ |
|
|
|
@ -101,7 +94,6 @@ export function deletes(url){ |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//不要忘记export
|
|
|
|
|
export { |
|
|
|
|
service |
|
|
|
|