1234567891011121314151617181920212223242526272829303132 |
- import { stringify } from 'qs';
- import request from '../utils/request';
- import { order } from '../utils/api';
- export async function query(params) {
- return request(`${order}?${stringify(params)}`);
- }
- export async function queryOne({ id }) {
- return request(`${order.replace('/:id', `/${id}`)}`);
- }
- export async function create(params) {
- const options = {
- method: 'POST',
- body: JSON.stringify(params),
- };
- return request(`${order.replace('/:id', '')}`, options);
- }
- export async function update(params) {
- const options = {
- method: 'PUT',
- body: JSON.stringify(params),
- };
- return request(`${order.replace('/:id', '')}`, options);
- }
- export async function remove({ id }) {
- const options = { method: 'DELETE' };
- return request(`${order.replace('/:id', `/${id}`)}`, options);
- }
|