Separated session checker and page login verifier into components

This commit is contained in:
Keannu Christian Bernasol 2023-03-06 20:09:14 +08:00
parent b12f205efd
commit c3ae196b6c
10 changed files with 101 additions and 65 deletions

View file

@ -8,18 +8,12 @@ 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";
import LoginChecker from "../../Components/LoginChecker/LoginChecker";
export default function Dashboard() {
const logged_in = useSelector((state: LoginState) => state.logged_in.value);
if (!logged_in) {
return <Navigate to="/Login" replace />;
}
return (
<div>
<LoginChecker />
<div style={styles.flex_row}>
<HomeIcon size={64} color="white" />
<h1 style={{ ...styles.text_white, ...styles.text_XL }}>Dashboard</h1>