bigbuffet-rw/packages/pl-hooks/lib/contexts/api-client.ts

17 lines
429 B
TypeScript
Raw Normal View History

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 };