123456789101112131415161718192021222324252627282930 |
- const axios = require('axios')
- axios.defaults.adapter = require("axios/lib/adapters/http");
- const axiosGet = function (url, params) {
- return new Promise((resolve, reject) => {
- axios
- .get(url, {
- params,
- })
- .then(res => {
- resolve(res);
- })
- .catch(err => {
- reject(err);
- });
- });
- }
- const axiosPost = function (url, params) {
- return new Promise((resolve, reject) => {
- axios
- .post(url, params)
- .then(res => {
- resolve(res);
- })
- .catch(err => {
- reject(err);
- });
- });
- }
|