logining
This commit is contained in:
@@ -3,8 +3,20 @@ import { Route, Routes } from "react-router-dom";
|
||||
import Login from "../views/home/auth/Login";
|
||||
import Register from "../views/home/auth/Register";
|
||||
import Menu from "../views/home/menu/Menu";
|
||||
import { useAppDispatch, useAppSelector } from "../redux/hooks";
|
||||
import { useEffect } from "react";
|
||||
import { fetchWhoAmI } from "../redux/slices/auth";
|
||||
|
||||
const Home = () => {
|
||||
const name = useAppSelector((state) => state.auth.username);
|
||||
const jwt = useAppSelector((state) => state.auth.jwt);
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(fetchWhoAmI());
|
||||
}, [jwt])
|
||||
|
||||
|
||||
return (
|
||||
<div className="h-full w-full bg-liquid-background grid grid-cols-[250px,1fr] divide-x-[1px] divide-liquid-lighter">
|
||||
<div className="">
|
||||
@@ -15,7 +27,7 @@ const Home = () => {
|
||||
<Route path="login" element={<Login />} />
|
||||
<Route path="account" element={<Login />} />
|
||||
<Route path="register" element={<Register />} />
|
||||
<Route path="*" element={"123"} />
|
||||
<Route path="*" element={name} />
|
||||
</Routes>
|
||||
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user