updated NPED code

This commit is contained in:
2025-08-29 10:07:59 +01:00
parent 5ededd8e05
commit d2b8827987
16 changed files with 285 additions and 150 deletions

View File

@@ -0,0 +1,17 @@
import { createContext, useContext, type SetStateAction } from "react";
import type { NPEDUser } from "../types/types";
type UserContextValue = {
user: NPEDUser | 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;
};