From 00308d67180fca388ce6357c54a603164a6f3a4d Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Sun, 16 May 2021 23:19:02 +0300 Subject: [PATCH] chore: some cosmetic changes --- src/client.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/client.ts b/src/client.ts index e1f5c16..1bf4ecb 100644 --- a/src/client.ts +++ b/src/client.ts @@ -2,11 +2,11 @@ import invariant from 'tiny-invariant'; import { Method } from './endpoint'; import { formDataFromObject, isFunction, urlSearchParamsFromObject } from './misc'; -export type ClientConfig = { +export interface ClientConfig { baseUrl: string, } -type PrepareRequestProps = { +export interface PrepareRequestProps { url: string, method: Method, headers: Record, @@ -28,9 +28,9 @@ export type ClientResponse> = export class Client { private controller = new AbortController(); - constructor(private config: ClientConfig) {} + constructor(private readonly config: ClientConfig) {} - public prepareRequest(props: PrepareRequestProps) { + prepareRequest(props: PrepareRequestProps) { const requestCanContainBody = [Method.POST, Method.PATCH, Method.PUT].includes(props.method); const defaultBaseUrl = (window as Window | undefined)?.location.href; @@ -79,7 +79,7 @@ export class Client { ); } - public request>( + request>( { transformResponseData, ...restProps @@ -132,7 +132,7 @@ export class Client { }); } - public cancelRequest() { + cancelRequest() { this.controller.abort(); this.controller = new AbortController(); }