MCPcopy Create free account
hub / github.com/EsperoTech/yaade / UserProvider

Function UserProvider

client/src/context/UserContext.tsx:23–42  ·  view source on GitHub ↗
({ children })

Source from the content-addressed store, hash-verified

21});
22
23const UserProvider: FunctionComponent = ({ children }) => {
24 const [user, setUser] = useState<User>();
25
26 const isAdmin = () => {
27 const groups = (user?.data?.groups ?? []) as Array<string>;
28 return groups.includes('admin');
29 };
30
31 return (
32 <UserContext.Provider
33 value={{
34 user,
35 setUser,
36 isAdmin,
37 }}
38 >
39 {children}
40 </UserContext.Provider>
41 );
42};
43
44export { UserContext };
45

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected