mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-10 20:02:26 +00:00
19 lines
583 B
TypeScript
19 lines
583 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; |