Skip to content

Commit

Permalink
Updated warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
remyvdwereld committed Aug 1, 2024
1 parent 4372ac5 commit 2758167
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/app/state/rest/hooks/useApiRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ const useApiRequest = <Schema, Payload = Partial<Schema>>({ url, groupName, hand
const response: unknown = await request<Schema>(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
Expand Down Expand Up @@ -102,7 +104,7 @@ const useApiRequest = <Schema, Payload = Partial<Schema>>({ 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 ]
)

Expand Down

0 comments on commit 2758167

Please sign in to comment.