mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-09 06:26:40 +00:00
20 lines
584 B
TypeScript
20 lines
584 B
TypeScript
import { GetDomainResponse } from "@server/routers/domain/getDomain";
|
|
import { createContext, useContext } from "react";
|
|
interface DomainContextType {
|
|
domain: GetDomainResponse;
|
|
updateDomain: (updatedDomain: Partial<GetDomainResponse>) => void;
|
|
orgId: string;
|
|
}
|
|
|
|
const DomainContext = createContext<DomainContextType | undefined>(undefined);
|
|
|
|
export function useDomain() {
|
|
const context = useContext(DomainContext);
|
|
if (!context) {
|
|
throw new Error("useDomain must be used within DomainProvider");
|
|
}
|
|
return context;
|
|
}
|
|
|
|
export default DomainContext;
|