Files
chatai/src/utils/http.js

11 lines
332 B
JavaScript
Raw Normal View History

2023-05-15 23:45:11 +08:00
import qs from "query-string"
2023-05-15 01:24:18 +08:00
const ins = {
2023-11-09 15:21:33 +08:00
post: (url, body, config = {}) => {
const {params: query} = config
return fetch(qs.stringifyUrl({url, query}), {...config, method: "POST", body})
},
2023-05-15 23:45:11 +08:00
get: (url, config) => fetch(qs.stringifyUrl({url, query: config.params}), {...config, method: "GET"}),
2023-05-15 01:24:18 +08:00
}
2023-05-12 15:53:39 +08:00
export default ins