From 27581675e3500e2d6e992ecc6dfcdf7422f14db3 Mon Sep 17 00:00:00 2001 From: Remy van der Wereld Date: Thu, 1 Aug 2024 11:00:39 +0200 Subject: [PATCH] Updated warnings --- src/app/state/rest/hooks/useApiRequest.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/state/rest/hooks/useApiRequest.ts b/src/app/state/rest/hooks/useApiRequest.ts index 0824745..9a97266 100644 --- a/src/app/state/rest/hooks/useApiRequest.ts +++ b/src/app/state/rest/hooks/useApiRequest.ts @@ -58,7 +58,9 @@ const useApiRequest = >({ url, groupName, hand const response: unknown = await request(options.method, url, payload) //TODO any used to be unknown if (isGetOptions(options) || (isMutateOptions(options) && options.useResponseAsCache)) { - setCacheItem(url, response?.data) + if (response && typeof response === "object" && "data" in response) { + setCacheItem(url, response?.data) + } } return response @@ -102,7 +104,7 @@ const useApiRequest = >({ url, groupName, hand queueRequest({ method: "delete", ...options }), [ queueRequest ]) const updateCache = useCallback( - (updater: (item: Schema) => void) => updateCacheItem(url, updater), + (updater: (item: unknown) => void) => updateCacheItem(url, updater), [ updateCacheItem, url ] )