aboutsummaryrefslogtreecommitdiff
path: root/src/web/contexts/UserContext.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/web/contexts/UserContext.jsx')
-rw-r--r--src/web/contexts/UserContext.jsx16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/web/contexts/UserContext.jsx b/src/web/contexts/UserContext.jsx
new file mode 100644
index 0000000..82e4f05
--- /dev/null
+++ b/src/web/contexts/UserContext.jsx
@@ -0,0 +1,16 @@
+import React, {createContext, useState} from "react";
+
+import {maybeGetUser} from "helpers/Auth.jsx";
+
+const UserContext = createContext(null);
+function UserContextProvider({children}) {
+ const state = useState(maybeGetUser());
+
+ return (
+ <UserContext.Provider value={state}>
+ {children}
+ </UserContext.Provider>
+ );
+}
+
+export {UserContext, UserContextProvider}; \ No newline at end of file