layout modified

parent b93c0ac1
...@@ -13,7 +13,7 @@ function App() { ...@@ -13,7 +13,7 @@ function App() {
<Route path='/' element={<Home />}/> <Route path='/' element={<Home />}/>
<Route path="/dashboard" element={<Layout><Dashboard/></Layout>}/> <Route path="/dashboard" element={<Layout><Dashboard/></Layout>}/>
<Route path="/viewreportee/:id" element={<Layout><Reports/></Layout>}/> <Route path="/viewreportee/:id" element={<Layout><Reports/></Layout>}/>
<Route path="/*" element={<Layout><PageNotFound/></Layout>}/> <Route path="/*" element={<PageNotFound/>}/>
</Routes> </Routes>
</BrowserRouter> </BrowserRouter>
); );
......
...@@ -37,7 +37,7 @@ function Table({headers, data,loading, maxHeight}) { ...@@ -37,7 +37,7 @@ function Table({headers, data,loading, maxHeight}) {
); );
else else
return <div className="w-full h-full"> return <div className="w-full h-full">
<p className="text-center align-middle mt-14 mb-14 text-blue-500">No records to display</p> <p className="text-center align-middle pt-14 pb-14 text-blue-500">No records to display</p>
</div> </div>
} }
......
...@@ -3,7 +3,7 @@ import { useNavigate } from "react-router-dom"; ...@@ -3,7 +3,7 @@ import { useNavigate } from "react-router-dom";
import axios from 'axios'; import axios from 'axios';
import { base_url } from "../../utils/constants"; import { base_url } from "../../utils/constants";
import { loginUser } from "../../redux/reducers/userSlice"; import { loginUser } from "../../redux/reducers/userSlice";
import {useDispatch} from 'react-redux' import {useDispatch,useSelector} from 'react-redux'
import Loading from '../../components/loading Component/Loading' import Loading from '../../components/loading Component/Loading'
function Home() { function Home() {
...@@ -12,6 +12,7 @@ function Home() { ...@@ -12,6 +12,7 @@ function Home() {
const [id, setId] = useState(null); const [id, setId] = useState(null);
const [errorMsg,setErrorMsg]=useState("") const [errorMsg,setErrorMsg]=useState("")
const [loading,setLoading]=useState(true) const [loading,setLoading]=useState(true)
const userDetails = useSelector((state) => state.userDetails);
const handleNavigate = async () => { const handleNavigate = async () => {
...@@ -36,6 +37,12 @@ function Home() { ...@@ -36,6 +37,12 @@ function Home() {
useEffect(()=>{ useEffect(()=>{
setLoading(false) setLoading(false)
},[]) },[])
useEffect(()=>{
if (userDetails?.user!=null)
navigate("/dashboard")
else
navigate("/")
},[userDetails])
return ( return (
<div className="container py-10 px-10 mx-0 min-w-full h-screen flex items-center justify-center bg-blue-100 "> <div className="container py-10 px-10 mx-0 min-w-full h-screen flex items-center justify-center bg-blue-100 ">
......
...@@ -2,8 +2,8 @@ import React, { memo } from 'react'; ...@@ -2,8 +2,8 @@ import React, { memo } from 'react';
const PageNotFound = memo(() => { const PageNotFound = memo(() => {
return ( return (
<div className="w-full h-full"> <div className="w-full h-full ">
<p className="text-center align-middle mt-14 mb-14 text-red-500">Page Not Found</p> <p className="text-center align-middle pt-14 pb-14 text-red-500 text-3xl font-bold">Page Not Found</p>
</div> </div>
); );
}); });
......
...@@ -152,7 +152,7 @@ return ( ...@@ -152,7 +152,7 @@ return (
); );
else else
return <div className="w-full h-full"> return <div className="w-full h-full">
<p className="text-center align-middle mt-14 mb-14 text-blue-500">The Employee data you are trying to access <br/> is not under you reportees so data is hidden.</p> <p className="text-center align-middle pt-14 pb-14 text-blue-500">The Employee data you are trying to access <br/> is not under you reportees so data is hidden.</p>
</div> </div>
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment