You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

66 lines
1.8 KiB

import request from "@/api/request";
const sysConfig = JSON.parse(window.sessionStorage.getItem('sysConfig'))
export async function getapi(url, params = {}, config) {
return new Promise((resolve, reject) => {
request
.get(`${sysConfig.apiurl}${url}`, {
params: params,
...config,
})
.then((res) => {
resolve(res);
})
.catch((err) => {
reject(err.data);
})
.finally(() => {});
});
}
//axios封装post
export async function postapi(url, paramsdata = {}, config) {
return new Promise((resolve, reject) => {
request
.post(`${sysConfig.apiurl}${url}`, paramsdata, config)
.then((res) => {
resolve(res);
})
.catch((err) => {
reject(err.data);
})
.finally(() => {});
});
}
//axios封装deleteapi
export async function deletapi(url, params = {}, config) {
return new Promise((resolve, reject) => {
request
.delete(`${sysConfig.apiurl}${url}`, {
params: params,
...config,
})
.then((res) => {
resolve(res);
})
.catch((err) => {
reject(err.data);
})
.finally(() => {});
});
}
//axios封装Put方法
export async function putapi(url, params = {}, config) {
return new Promise((resolve, reject) => {
request
.put(`${sysConfig.apiurl}${url}`, params, config)
.then((res) => {
resolve(res);
})
.catch((err) => {
reject(err.data);
})
.finally(() => {});
});
}