Skip to content

Commit

Permalink
feat(fetch): StringifyableFetchOptions type
Browse files Browse the repository at this point in the history
Co-authored-by: Mohammad Honarvar <[email protected]>
  • Loading branch information
alimd and mohammadhonarvar committed Mar 18, 2023
1 parent 5740467 commit e13fdb2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
11 changes: 2 additions & 9 deletions core/fetch/src/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,15 @@ import {createLogger, globalAlwatr, isBrowser} from '@alwatr/logger';
import {contextProvider, type DispatchOptions} from '@alwatr/signal';
import {getClientId} from '@alwatr/util';

import type {FetchOptions, CacheDuplicate, CacheStrategy} from './type.js';
import type {FetchOptions} from './type.js';
import type {
AlwatrServiceResponse,
AlwatrServiceResponseSuccessWithMeta,
AlwatrServiceResponseSuccess,
StringifyableRecord,
} from '@alwatr/type';

export type {
FetchOptions,
CacheDuplicate,
CacheStrategy,
AlwatrServiceResponse,
AlwatrServiceResponseSuccessWithMeta,
AlwatrServiceResponseSuccess,
};
export type * from './type.js';

const logger = createLogger('alwatr/fetch');

Expand Down
22 changes: 22 additions & 0 deletions core/fetch/src/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,25 @@ export interface FetchOptions extends RequestInit {
*/
token?: string;
}

export type StringifyableFetchOptions = Pick<
FetchOptions,
| 'url'
| 'bodyJson'
| 'cache'
| 'cacheStorageName'
| 'cacheStrategy'
| 'headers'
| 'credentials'
| 'keepalive'
| 'method'
| 'mode'
| 'queryParameters'
| 'removeDuplicate'
| 'timeout'
| 'token'
| 'retry'
| 'retryDelay'
| 'referrer'
| 'referrerPolicy'
>;

0 comments on commit e13fdb2

Please sign in to comment.