29 lines
731 B
JavaScript
29 lines
731 B
JavaScript
import { message } from "ant-design-vue";
|
|
import axios from "axios";
|
|
export async function get(url, params) {
|
|
var response = await axios.get(url, { params });
|
|
if (response.status == 200) {
|
|
return response.data;
|
|
} else if (response.status == 401) {
|
|
message.warning(
|
|
"未登录或身份认证信息已过期",
|
|
(onclose = () => {
|
|
top && top.login();
|
|
})
|
|
);
|
|
}
|
|
}
|
|
export async function post(url, data) {
|
|
var response = await axios.post(url, data);
|
|
if (response.status == 200) {
|
|
return response.data;
|
|
} else if (response.status == 401) {
|
|
message.warning(
|
|
"未登录或身份认证信息已过期",
|
|
(onclose = () => {
|
|
top && top.login();
|
|
})
|
|
);
|
|
}
|
|
}
|