Created the AccountContext.jsx
This commit is contained in:
parent
785655a1b6
commit
0067033edb
24
src/common/contexts/Account/AccountContext.jsx
Normal file
24
src/common/contexts/Account/AccountContext.jsx
Normal file
@ -0,0 +1,24 @@
|
||||
import {createContext, useEffect, useState} from "react";
|
||||
|
||||
|
||||
export const AccountContext = createContext({});
|
||||
|
||||
export const AccountProvider = ({children}) => {
|
||||
|
||||
const [sessionToken, setSessionToken] = useState(localStorage.getItem("sessionToken") || null);
|
||||
const [user, setUser] = useState(null);
|
||||
|
||||
const updateInformation = () => {
|
||||
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
updateInformation();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<AccountContext.Provider value={[user, sessionToken, setSessionToken, updateInformation]}>
|
||||
{children}
|
||||
</AccountContext.Provider>
|
||||
)
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user