From e8077c8bbce2ad2d3e757b4a17c4c2c05638371b Mon Sep 17 00:00:00 2001 From: Frederik Batuna Date: Mon, 18 Nov 2024 19:40:37 +0100 Subject: [PATCH] ts fixes --- ts/fetch-client.ts | 41 ++++++++++++++++++++--------------------- ts/react-query.tsx | 2 +- tsconfig.json | 3 ++- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/ts/fetch-client.ts b/ts/fetch-client.ts index 13b17becfd3..b4991f4860e 100644 --- a/ts/fetch-client.ts +++ b/ts/fetch-client.ts @@ -19,7 +19,7 @@ export type RequestConfig = { headers?: HeadersInit; }; -export type ResponseConfig = { +export type ResponseConfig = { data: TData; status: number; statusText: string; @@ -29,27 +29,26 @@ export async function fetchClient< TData, TError = unknown, TVariables = unknown ->(config: RequestConfig): Promise> { - - const response = await (global as any).fetch( - `${Config.API_URL_PREFIX}${config.baseURL}${config.url}`, - { - method: config.method.toUpperCase(), - body: JSON.stringify(config.data), - signal: config.signal, - headers: { - Authorization: `Bearer ${sessionTokenSelector(store.getState())}`, - ...config.headers - } +>(config: RequestConfig): Promise> { + const response = await (global as any).fetch( + `${Config.API_URL_PREFIX}${config.baseURL}${config.url}`, + { + method: config.method.toUpperCase(), + body: JSON.stringify(config.data), + signal: config.signal, + headers: { + Authorization: `Bearer ${sessionTokenSelector(store.getState())}`, + ...config.headers } - ); - const data = await response.json(); - return { - data, - status: response.status, - statusText: response.statusText - }; - } + } + ); + const data = await response.json(); + void null as TError; + return { + data, + status: response.status, + statusText: response.statusText + }; } export default fetchClient; diff --git a/ts/react-query.tsx b/ts/react-query.tsx index 069384e10e7..6699bc39d88 100644 --- a/ts/react-query.tsx +++ b/ts/react-query.tsx @@ -122,7 +122,7 @@ export function useFocusNotifyOnChangeProps( } /** https://tanstack.com/query/latest/docs/framework/react/react-native#disable-queries-on-out-of-focus-screens */ -export function useQueryFocusAware(notifyOnChangeProps?: NotifyOnChangeProps) { +export function useQueryFocusAware() { const focusedRef = useFocusedRef(); return () => focusedRef.current; } diff --git a/tsconfig.json b/tsconfig.json index c644f984176..0c25a269ac5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -25,6 +25,7 @@ "exclude": [ "android", "ios", - "node_modules" + "node_modules", + "fetch-sdk" ] }