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 21 22 23 24 25 26 27 28 29 30 31 32 | 3x 3x 31x 3x 33x 33x 2x 31x | import React, { createContext, useContext } from "react";
import type { HttpReadableClient, RequestGuard } from "./apiQuery";
export interface ApiQueryClientsValue {
mainHttp: HttpReadableClient;
spaceHttp: HttpReadableClient;
requestGuard?: RequestGuard;
}
const ApiQueryClientsContext = createContext<ApiQueryClientsValue | null>(null);
export const ApiQueryClientsProvider = ({
value,
children,
}: {
value: ApiQueryClientsValue;
children?: React.ReactNode;
}) => React.createElement(ApiQueryClientsContext.Provider, { value }, children);
export const useApiQueryClients = () => {
const context = useContext(ApiQueryClientsContext);
if (!context) {
throw new Error(
"useApiQueryClients must be used within ApiQueryClientsProvider",
);
}
return context;
};
|