mirror of
https://github.com/Qortal/names.git
synced 2025-06-18 12:11:21 +00:00
21 lines
524 B
TypeScript
21 lines
524 B
TypeScript
// PendingTxsContext.tsx
|
|
import { createContext, useContext } from 'react';
|
|
|
|
export type FetchPrimaryNameType = (address: string) => void;
|
|
|
|
type FetchNamesContextType = {
|
|
fetchPrimaryName: FetchPrimaryNameType;
|
|
};
|
|
|
|
export const FetchNamesContext = createContext<
|
|
FetchNamesContextType | undefined
|
|
>(undefined);
|
|
|
|
export const useFetchNames = () => {
|
|
const context = useContext(FetchNamesContext);
|
|
if (!context) {
|
|
throw new Error('useFetchNames must be used within a FetchNamesProvider');
|
|
}
|
|
return context;
|
|
};
|