diff --git a/.env b/.env index b24b765..78f19ee 100644 --- a/.env +++ b/.env @@ -1,5 +1,5 @@ VITE_API_URL='https://ssa.betadelivery.com/apia/v1' # VITE_API_URL='http://192.16.50.44/seo-backend/apia/v1' VITE_USER_NAME="Admin" -VITE_PASSWORD="71%@L%es^bUX94`J9XT*%4&^%tUU^%Q^ffgt" +VITE_PASSWORD="71%@L%es^bUX94`J9XT*@bh,._WWM{$%^^&&" VITE_APP_NAME=MyViteApp \ No newline at end of file diff --git a/dev-dist/sw.js b/dev-dist/sw.js index acea9fc..a44d858 100644 --- a/dev-dist/sw.js +++ b/dev-dist/sw.js @@ -82,7 +82,7 @@ define(['./workbox-54d0af47'], (function (workbox) { 'use strict'; "revision": "3ca0b8505b4bec776b69afdba2768812" }, { "url": "index.html", - "revision": "0.i87c5gdh6n" + "revision": "0.g82l9bbo3ro" }], {}); workbox.cleanupOutdatedCaches(); workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), { diff --git a/src/App.tsx b/src/App.tsx index 2b7873a..b9302aa 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,20 +1,20 @@ +import { useContext } from 'react'; import { Route, BrowserRouter as Router, Routes } from "react-router-dom"; +import GlobalStateContext from './Contexts/GlobalStateContext'; import DefaultLayout from './Layouts/DefaultLayout'; import Login from './Pages/Login'; import { RouteLink } from './Routes/Routes'; -import Cookies from "js-cookie"; function App() { - // const context = useContext(GlobalStateContext); - // if (!context) throw new Error('App must be used within a GlobalStateProvider'); - // const { isAuthenticate } = context; - const token = Cookies.get("token") + const context = useContext(GlobalStateContext); + if (!context) throw new Error('App must be used within a GlobalStateProvider'); + const { isAuthenticate } = context; return ( } /> - {RouteLink.map(({ path, Component }, index) => (} />))}) : ()} /> + {RouteLink.map(({ path, Component }, index) => (} />))}) : ()} /> } /> diff --git a/src/Contexts/GlobalStateProvider.tsx b/src/Contexts/GlobalStateProvider.tsx index 9a839de..105a8cb 100644 --- a/src/Contexts/GlobalStateProvider.tsx +++ b/src/Contexts/GlobalStateProvider.tsx @@ -1,11 +1,11 @@ -import { ReactNode, useState } from 'react'; +import { ReactNode, useState } from 'react'; import GlobalStateContext from './GlobalStateContext'; -const GlobalStateProvider = ({ children }:{children:ReactNode}) => { - const [isAuthenticate, setIsAuthenticate] = useState(false); +const GlobalStateProvider = ({ children }: { children: ReactNode }) => { + const [isAuthenticate, setIsAuthenticate] = useState(true); return ( diff --git a/src/Layouts/DefaultLayout.tsx b/src/Layouts/DefaultLayout.tsx index b52e7d5..2e63eae 100644 --- a/src/Layouts/DefaultLayout.tsx +++ b/src/Layouts/DefaultLayout.tsx @@ -6,8 +6,12 @@ import { nav } from "../Routes/Nav"; import logo from '../assets/logo.svg'; import { AccordionItem, AccordionItemContent, AccordionItemTrigger, AccordionRoot } from "../components/ui/accordion"; import { Avatar } from "../components/ui/avatar"; +import { LuLogOut } from "react-icons/lu"; +import { logout, setToken } from "../Redux/Service/authSlice"; +import { useDispatch } from "react-redux"; const DefaultLayout: FC<{ children: React.ReactNode }> = ({ children }) => { + const dispatch = useDispatch() const navigate = useNavigate() const location = useLocation() @@ -15,25 +19,31 @@ const DefaultLayout: FC<{ children: React.ReactNode }> = ({ children }) => { return ( - + - + - + {nav?.map(({ title, path, Icon, type, children }, index) => type === 'single' ? {title} : - + navigate(path)} gap={0} style={{ cursor: 'pointer', borderRadius: '8px', padding: '5px', width: '100%', display: 'flex', alignItems: 'center', border: '1px solid #ffffff', backgroundColor:'#fff',color:'#000', fontSize: '14px', }}> {title} {children?.map(({ title, path, Icon }, index) => navigate(path)} style={{ marginTop: 6, cursor: 'pointer', borderRadius: '8px', padding: '6px', width: '100%', display: 'flex', alignItems: 'center', gap: 6, border: '1px solid #ffffff', backgroundColor:'#fff',color:'#919198' }} > {title})} )} + + + {dispatch(logout()), navigate('/login')}} className="link" style={{ cursor: 'pointer', borderRadius: '8px', padding: '6px', width: '100%', display: 'flex', alignItems: 'center', gap: 6, border: '1px solid #ffffff', backgroundColor:'#fff', color:'#000', boxShadow:'rgba(99, 99, 99, 0.2) 0px 2px 8px 0px'}} > Logout + - - + + + + navigate('/profile')} > diff --git a/src/Pages/Dashboard/Dashboard.tsx b/src/Pages/Dashboard/Dashboard.tsx index 056fa6c..10539a7 100644 --- a/src/Pages/Dashboard/Dashboard.tsx +++ b/src/Pages/Dashboard/Dashboard.tsx @@ -67,8 +67,8 @@ const Dashboard = () => { return ( - - + + Total Users @@ -117,6 +117,7 @@ const Dashboard = () => { @@ -140,13 +141,14 @@ const Dashboard = () => { w={"20%"} boxShadow={"rgba(99, 99, 99, 0.2) 0px 2px 8px 0px"} p={'10px'} + rounded={'lg'} > Number Of Groups created - - + + Faqs