mirror of
https://github.com/lemeow125/Ivy-Frontend.git
synced 2025-05-14 18:41:06 +08:00
Restrict all pages to only logged in users
This commit is contained in:
parent
18d9fbe1ef
commit
9cdca33783
6 changed files with 40 additions and 2 deletions
|
@ -8,8 +8,16 @@ import styles from "../../styles";
|
|||
import HomeIcon from "../../Components/Icons/HomeIcon/HomeIcon";
|
||||
import ColoredCube from "../../Components/ColoredCube/ColoredCube";
|
||||
import RecentlyAddedIcon from "../../Components/Icons/RecentlyAddedIcon/RecentlyAddedIcon";
|
||||
import { Navigate } from "react-router-dom";
|
||||
import { LoginState } from "../../Interfaces/Interfaces";
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
export default function Dashboard() {
|
||||
const logged_in = useSelector((state: LoginState) => state.logged_in.value);
|
||||
if (!logged_in) {
|
||||
return <Navigate to="/Login" replace />;
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div style={styles.flex_row}>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue