mirror of
https://github.com/bubblecup-12/VogelSocialMedia.git
synced 2025-07-06 15:18:48 +00:00
wip add delete function
This commit is contained in:
parent
a70802f955
commit
a6d94dae3e
1 changed files with 19 additions and 2 deletions
|
@ -8,6 +8,7 @@ import PersonIcon from '@mui/icons-material/Person';
|
||||||
import InfoIcon from '@mui/icons-material/Info';
|
import InfoIcon from '@mui/icons-material/Info';
|
||||||
import LogoutIcon from '@mui/icons-material/Logout';
|
import LogoutIcon from '@mui/icons-material/Logout';
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
import axios from "axios";
|
||||||
|
|
||||||
// TODO: Dinge so umstrukturieren, dass der State für das offene menü in Header ist und das Menü auch in Header, sodass es mit width 100% die volle breite einnehmen kann
|
// TODO: Dinge so umstrukturieren, dass der State für das offene menü in Header ist und das Menü auch in Header, sodass es mit width 100% die volle breite einnehmen kann
|
||||||
|
|
||||||
|
@ -18,8 +19,16 @@ function Header() {
|
||||||
const toggleMenu = () => {
|
const toggleMenu = () => {
|
||||||
setIsOpen(!isOpen);
|
setIsOpen(!isOpen);
|
||||||
};
|
};
|
||||||
|
// TODO
|
||||||
|
const logOut = async () => {
|
||||||
|
try {
|
||||||
|
const response = await axios.delete("http://localhost:3001/api/user/delete");
|
||||||
|
} catch (err: any) {
|
||||||
|
console.error("error: ", err.response.data);
|
||||||
|
}
|
||||||
|
};
|
||||||
const iconList = [DynamicFeedIcon, AddAPhotoIcon, PersonIcon, InfoIcon, LogoutIcon];
|
const iconList = [DynamicFeedIcon, AddAPhotoIcon, PersonIcon, InfoIcon, LogoutIcon];
|
||||||
const routerLinksList = ["/","/createpost","/profile","/aboutus","/"]
|
const routerLinksList = ["/","/createpost","/profile","/about","/"]
|
||||||
|
|
||||||
const DrawerList = (
|
const DrawerList = (
|
||||||
<Box sx={{ width: 250 }} role="presentation" onClick={() => setIsOpen(false)}>
|
<Box sx={{ width: 250 }} role="presentation" onClick={() => setIsOpen(false)}>
|
||||||
|
@ -33,7 +42,7 @@ function Header() {
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<List sx={{height:'100vh', bgcolor: 'background.paper'}}>
|
<List sx={{height:'100vh', bgcolor: 'background.paper'}}>
|
||||||
{["Feed", "Create Post", "Profile", "About Us", "Log Out"].map((text, index) => (
|
{["Feed", "Create Post", "Profile", "About Us"].map((text, index) => (
|
||||||
<ListItem sx={{height: '10vh'}} key={text} disablePadding>
|
<ListItem sx={{height: '10vh'}} key={text} disablePadding>
|
||||||
<ListItemButton sx={{height: '10vh'}} component={Link} to={routerLinksList[index]} >
|
<ListItemButton sx={{height: '10vh'}} component={Link} to={routerLinksList[index]} >
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
|
@ -43,6 +52,14 @@ function Header() {
|
||||||
</ListItemButton>
|
</ListItemButton>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
))}
|
))}
|
||||||
|
<ListItem sx={{height: '10vh'}} key={"Log Out"} disablePadding>
|
||||||
|
<ListItemButton sx={{height: '10vh'}} onClick={logOut}>
|
||||||
|
<ListItemIcon>
|
||||||
|
{React.createElement(iconList[4])}
|
||||||
|
</ListItemIcon>
|
||||||
|
<ListItemText primary={"Log Out"} slotProps={{primary: {color: 'primary'}}}/>
|
||||||
|
</ListItemButton>
|
||||||
|
</ListItem>
|
||||||
</List>
|
</List>
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue