Updated the UserProvider.jsx

This commit is contained in:
Mathias Wagner 2024-01-01 12:31:42 +01:00
parent 0b93f024ec
commit a7eec6de05
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

View File

@ -6,7 +6,9 @@ export const UserContext = createContext({});
export const UserProvider = ({children}) => { export const UserProvider = ({children}) => {
const [user, setUser] = useState(null); const [user, setUser] = useState(null);
const updateUser = async () => jsonRequest("/user/@me").then((res) => setUser(res)); const updateUser = async () => jsonRequest("/user/@me")
.catch(() => setUser(null))
.then((res) => setUser(res));
useEffect(() => { useEffect(() => {
updateUser(); updateUser();