PK!A7��nimport Navbar from "./Components/Navbar"; import { Route, RouterProvider, Routes } from "react-router-dom"; import React, { useEffect, useState } from "react"; import { useSelector, useDispatch } from "react-redux"; import Config from "./Config"; import moment from "moment"; import Login from "./Pages/LoginPage"; import AdminDashBoard from "./Pages/Admin/AdminDashBoard"; import Reports from "./Pages/Reports"; import AdminNavbar from "./Components/AdminNavbar"; //import DistrictRegistrars from "./Pages/Admin/RegionalRegistrar"; import Users from "./Pages/Admin/Users"; import Customers from "./Pages/Admin/Customers"; import { ToastContainer, toast } from "react-toastify"; import "react-toastify/dist/ReactToastify.css"; import Profile from "./Pages/Profile"; import SignupPage from "./Pages/SignupPage"; import ForgotPasswordPage from "./Pages/ForgotPassword"; import { useIdleTimer } from "react-idle-timer"; import "./i18"; import { Remove_User } from "./Redux/actions"; import RmUsers from "./Pages/Admin/Rmusers"; import PaymentLinks from "./Pages/Admin/PaymentLinks"; import PaymentAnalytics from "./Pages/Admin/PaymentAnalytics"; import PaymentAttempts from "./Pages/Admin/PaymentAttempts"; import NeedUnpublished from "./Pages/Admin/NeedUnpublished"; import HaveUnpublished from "./Pages/Admin/HaveUnpublished"; import NeedPublished from "./Pages/Admin/NeedPublished"; import HavePublished from "./Pages/Admin/HavePublished"; import PgPublished from "./Pages/Admin/PgPublished"; import PgUnpublished from "./Pages/Admin/PgUnpublished"; import Search from "./Pages/Admin/Search"; import FindPartner from "./Pages/Admin/FindPartner"; import TenantVerification from "./Pages/Admin/TenantVerification"; import RentAgreement from "./Pages/Admin/RentAgreement"; function App() { const user = useSelector((state) => state.UserReducer.user); const dispatch = useDispatch(); const isSessionExpired = () => { if (user) { const expireAt = user?.expireAt; const currentTime = moment().valueOf(); const isExpired = moment(currentTime).isAfter(expireAt); if (isExpired) { window.location.href = "/"; dispatch(Remove_User()); } } }; const { getRemainingTime } = useIdleTimer({ onIdle: () => isSessionExpired(), timeout: 1000 * 60 * Config.idleTime, }); useEffect(() => isSessionExpired(), []); //console.log(user); if (!user) return ( <> } /> } /> } /> ); return ( <> {/* {isAdmin ? : } */} } /> {/* Finance */} {user?.userType == 2 && ( <> } /> } /> )} {/* Admin */} {user?.userType == 1 && ( <> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> )} {/* Ops */} {user?.userType == 3 && ( <> } /> } /> } /> } /> {/* } /> */} } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> )} {/* Rm */} {user?.userType == 4 && ( <> } /> } /> } /> } /> } /> } /> } /> } /> )} {/*