@kevisual/query
TypeScript icon, indicating that this package has built-in type declarations

0.0.7-alpha.3 • Public • Published

query

对应的 fetch 内容的一部分功能的封装。

主要目的:请求路径默认/api/router,使用post,post的数据分流使用pathkey.

适配后端的项目 @kevisual/router

query

const query = new Query();
const res = await query.post({
  path: 'demo',
  key: '1',
});

参数

type QueryOpts = {
  url?: string;
  adapter?: typeof adapter;
  headers?: Record<string, string>;
  timeout?: number;
};
type Data = {
  path?: string;
  key?: string;
  [key: string]: any;
};
// 额外功能
type DataOpts = Partial<QueryOpts> & {
  beforeRequest?: Fn;
};

Readme

Keywords

Package Sidebar

Install

npm i @kevisual/query

Weekly Downloads

11

Version

0.0.7-alpha.3

License

ISC

Unpacked Size

26.8 kB

Total Files

8

Last publish

Collaborators

  • kevisual