mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 18:13:25 +00:00
Basically library structure
This commit is contained in:
24
src/fetchers/types.ts
Normal file
24
src/fetchers/types.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
export type FetcherOptions = {
|
||||
baseUrl?: string;
|
||||
headers?: Record<string, string>;
|
||||
query?: Record<string, string>;
|
||||
method?: 'GET' | 'POST';
|
||||
body?: Record<string, any> | string | FormData;
|
||||
};
|
||||
|
||||
export type DefaultedFetcherOptions = {
|
||||
baseUrl?: string;
|
||||
body?: Record<string, any> | string | FormData;
|
||||
headers: Record<string, string>;
|
||||
query: Record<string, string>;
|
||||
method: 'GET' | 'POST';
|
||||
};
|
||||
|
||||
export type Fetcher<T = any> = {
|
||||
(url: string, ops: DefaultedFetcherOptions): T;
|
||||
};
|
||||
|
||||
// this feature has some quality of life features
|
||||
export type UseableFetcher<T = any> = {
|
||||
(url: string, ops?: FetcherOptions): T;
|
||||
};
|
Reference in New Issue
Block a user