@moneko/request
v1.1.1
Published
A lightweight and flexible request library for Node.js and browsers
Downloads
232
Maintainers
Readme
@moneko/request
设置响应拦截器、请求前缀
// @/services/index.ts
import { extend } from '@moneko/request';
export { request } from '@moneko/request';
extend({
interceptor: {
response: (resp) => resp,
},
prefixUrl: '/api',
});
调用request案例
import { request } from '@/services';
export const getApi = () => request('/metrics');
export const postApi = (params = {}) => request('/metrics', { data: params, method: 'POST' });