mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-student.git
synced 2025-12-14 05:16:47 +08:00
feat:合并
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import router from "@/router";
|
||||
import {ref, watch} from "vue";
|
||||
import { ref, watch } from "vue";
|
||||
import axios from 'axios';
|
||||
|
||||
export function useRequest(_url, params = {}) {
|
||||
@@ -49,20 +49,20 @@ export async function request(_url, params) {
|
||||
method,
|
||||
headers: {
|
||||
'X-Token': localStorage.getItem('token'),
|
||||
...method !== 'get' ? {'Content-Type': 'application/json'} : {}
|
||||
...method !== 'get' ? { 'Content-Type': 'application/json' } : {}
|
||||
},
|
||||
baseURL: '',
|
||||
...method !== 'get' ? {data: JSON.stringify(body)} : {}
|
||||
}).then(resp=>resp.data).then(response => {
|
||||
...method !== 'get' ? { data: JSON.stringify(body) } : {}
|
||||
}).then(resp => resp.data).then(response => {
|
||||
if (response.code !== 200 && response.code !== 0) {
|
||||
if (response.code === 3 || response.code === 4 || response.code === 100) {
|
||||
// router.push({path: '/login'})
|
||||
// router.push({path: '/login'})
|
||||
return
|
||||
} else {
|
||||
// response.showMsg && notification.open({
|
||||
// message: response.showMsg,
|
||||
// duration: 2,
|
||||
// });
|
||||
// response.showMsg && notification.open({
|
||||
// message: response.showMsg,
|
||||
// duration: 2,
|
||||
// });
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user