Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 105x 105x | import { ReactNode } from "react";
import { opensearch, ReactQueryApiError } from "shared-types";
import { createContextProvider } from "@/utils";
export type ContextState = {
data: opensearch.main.Response["hits"] | undefined;
isLoading: boolean;
error: ReactQueryApiError | null;
};
export const [OsContextProvider, useOsContext] = createContextProvider<ContextState>({
name: "OsSearch Context",
errorMessage: "forgot to wrap with OsProvider",
});
export const OsProvider = (props: { children: ReactNode; value: ContextState }) => {
return <OsContextProvider {...props} />;
};
|