Skip to content

Commit

Permalink
πŸ› Fix refresh on night mode
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinbreiz committed Jan 17, 2024
1 parent 1fb035f commit 73178c6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ const Navbar = () => {
const handleLogout = () => {
logout();
};

const handleToggleNightMode = () => {
toggleNightMode().then(() => {
window.location.reload();
}).catch(err => {
console.error('Erreur while switching night mode', err);
});
};

const classes = useStyles();

return (
Expand All @@ -40,7 +49,7 @@ const Navbar = () => {
<Typography variant="h6" className={classes.title}>
{t('navbar.dashboard')}
</Typography>
<IconButton onClick={toggleNightMode} color="inherit">
<IconButton onClick={handleToggleNightMode} color="inherit">
{isNightMode ? <Brightness4Icon /> : <Brightness7Icon />}
</IconButton>
<LanguageSwitcher />
Expand Down

0 comments on commit 73178c6

Please sign in to comment.