swapped to a new db locally hosted
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useContext } from 'react';
|
||||
import React, { useState, useContext, useEffect } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { Avatar, Menu, MenuItem, Button, Typography } from '@mui/material';
|
||||
import { UserContext } from '../contexts/UserContext';
|
||||
@@ -11,6 +11,17 @@ const UserSettings = () => {
|
||||
const [anchorEl, setAnchorEl] = useState(null);
|
||||
const [themeMenuAnchorEl, setThemeMenuAnchorEl] = useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
const storedUser = localStorage.getItem('user');
|
||||
if (storedUser) {
|
||||
try {
|
||||
setUser(JSON.parse(storedUser));
|
||||
} catch (error) {
|
||||
console.error("Failed to parse user from localStorage", error);
|
||||
}
|
||||
}
|
||||
}, [setUser]);
|
||||
|
||||
const handleMenu = (event) => {
|
||||
setAnchorEl(event.currentTarget);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user