mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-06 18:10:32 +00:00
refactor contexts, format zod errors, and more refactoring
This commit is contained in:
10
src/hooks/useOrgContext.ts
Normal file
10
src/hooks/useOrgContext.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import OrgContext from "@app/contexts/orgContext";
|
||||
import { useContext } from "react";
|
||||
|
||||
export function useOrgContext() {
|
||||
const context = useContext(OrgContext);
|
||||
if (context === undefined) {
|
||||
throw new Error("useOrgContext must be used within a OrgProvider");
|
||||
}
|
||||
return context;
|
||||
}
|
||||
@@ -4,7 +4,9 @@ import { useContext } from "react";
|
||||
export function useResourceContext() {
|
||||
const context = useContext(ResourceContext);
|
||||
if (context === undefined) {
|
||||
throw new Error('useResourceContext must be used within a ResourceProvider');
|
||||
throw new Error(
|
||||
"useResourceContext must be used within a ResourceProvider"
|
||||
);
|
||||
}
|
||||
return context;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user