got to a good point with sighting modal, want to do cleanup
This commit is contained in:
17
src/context/NPEDUserContext.ts
Normal file
17
src/context/NPEDUserContext.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { createContext, useContext, type SetStateAction } from "react";
|
||||
import type { NPEDCameraConfig, NPEDUser } from "../types/types";
|
||||
|
||||
type UserContextValue = {
|
||||
user: NPEDCameraConfig | null;
|
||||
setUser: React.Dispatch<SetStateAction<NPEDUser | null>>;
|
||||
};
|
||||
|
||||
export const NPEDUserContext = createContext<UserContextValue | undefined>(
|
||||
undefined
|
||||
);
|
||||
export const useNPEDContext = () => {
|
||||
const ctx = useContext(NPEDUserContext);
|
||||
if (!ctx)
|
||||
throw new Error("useNPEDContext must be used within <NPEDUserProvider>");
|
||||
return ctx;
|
||||
};
|
||||
Reference in New Issue
Block a user