Skip to content

Commit

Permalink
fix handleQueryState
Browse files Browse the repository at this point in the history
  • Loading branch information
SKairinos committed Aug 15, 2024
1 parent 1f925cb commit f04cf95
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/utils/api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { CircularProgress } from "@mui/material"
import type {
FetchBaseQueryError,
TypedUseQueryHookResult,
TypedUseQueryStateResult,
} from "@reduxjs/toolkit/query/react"
import { type ReactNode } from "react"

Expand Down Expand Up @@ -260,8 +261,10 @@ export type HandleQueryStateOptions = Partial<{
}>

export function handleQueryState<QueryArg, ResultType>(
result: TypedUseQueryHookResult<ResultType, QueryArg, any>,
children: (data: ResultType) => ReactNode,
result:
| TypedUseQueryHookResult<ResultType, QueryArg, any>
| TypedUseQueryStateResult<ResultType, QueryArg, any>,
children: (data: NonNullable<ResultType>) => ReactNode,
options?: HandleQueryStateOptions,
): ReactNode {
const { data, isLoading, isSuccess, error } = result
Expand Down

0 comments on commit f04cf95

Please sign in to comment.