bigbuffet-rw/packages/pl-hooks/lib/contexts/api-client.ts
marcin mikołajczak 9aa8ded6c6 Make pl-hooks self-containted
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-10-17 21:08:50 +02:00

16 lines
429 B
TypeScript

import { PlApiClient } from 'pl-api';
import React from 'react';
const PlHooksApiClientContext = React.createContext<{
client: PlApiClient;
me: string | null | false;
}>({
client: new PlApiClient(''),
me: null,
});
const PlHooksApiClientProvider = PlHooksApiClientContext.Provider;
const usePlHooksApiClient = () => React.useContext(PlHooksApiClientContext);
export { PlHooksApiClientProvider, usePlHooksApiClient };