mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-student.git
synced 2025-12-06 17:36:46 +08:00
api
This commit is contained in:
@@ -15,7 +15,8 @@
|
||||
"axios": "^1.1.3",
|
||||
"core-js": "^3.26.0",
|
||||
"dayjs": "^1.11.6",
|
||||
"element-plus": "^2.2.20",
|
||||
"element-plus": "^2.2.27",
|
||||
"json-bigint": "^1.0.0",
|
||||
"vue": "^3.2.45",
|
||||
"vue-router": "^4.1.6",
|
||||
"vuex": "^4.1.0"
|
||||
|
||||
9722
pnpm-lock.yaml
generated
9722
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,8 @@ import router from "@/router";
|
||||
import { reactive, ref, toRefs, watch } from "vue";
|
||||
import axios from 'axios';
|
||||
import { getCookie } from "@/api/utils";
|
||||
|
||||
import JSONBigInt from 'json-bigint';
|
||||
const JSONBigIntStr = JSONBigInt({ storeAsString: true });
|
||||
export function usePage(_url, param) {
|
||||
|
||||
const state = reactive({
|
||||
@@ -130,19 +131,16 @@ export async function boeRequest(_url, params) {
|
||||
}
|
||||
}
|
||||
const body = method !== 'get' ? params || {} : {}
|
||||
return axios({
|
||||
url,
|
||||
return fetch(url,{
|
||||
method,
|
||||
headers: {
|
||||
headers:{
|
||||
token: getCookie('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 => {
|
||||
return response
|
||||
}).catch(e => {
|
||||
console.log(e)
|
||||
// router.push({path: '/login'})
|
||||
...method !== 'get' ? {body: JSON.stringify(body)} : {}
|
||||
}).then(res=>{
|
||||
return res.text()
|
||||
}).then(res=>{
|
||||
return JSONBigIntStr.parse(res)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user