added new endpoint for top bar data

This commit is contained in:
victorAnumudu
2025-06-24 16:38:42 +01:00
parent ffd80d9888
commit 9d158fe1cb
5 changed files with 122 additions and 34 deletions
+10 -14
View File
@@ -1,25 +1,21 @@
import React, { useEffect, useState } from 'react'
import React, { useState } from 'react'
import { Outlet } from 'react-router-dom'
import MainLoaderBS from '../loaders/MainLoaderBS'
// import MainLoaderBS from '../loaders/MainLoaderBS'
export default function AuthLayout() {
const [loading, setLoading] = useState(true)
const [loading, setLoading] = useState(false)
useEffect(()=>{
const timer = setTimeout(()=>{
setLoading(false)
},500)
// useEffect(()=>{
// const timer = setTimeout(()=>{
// setLoading(false)
// },500)
return () => clearTimeout(timer)
},[])
// return () => clearTimeout(timer)
// },[])
return (
<div className="bg-white">
{loading ?
<MainLoaderBS />
:
<Outlet />
}
<Outlet />
</div>
)
}
+11 -2
View File
@@ -1,6 +1,6 @@
import React, { useState } from 'react'
import React, { useEffect, useState } from 'react'
import { useMutation } from '@tanstack/react-query'
import { useDispatch } from 'react-redux'
import { useDispatch, useSelector } from 'react-redux'
// import LoginImg from '../../assets/bg/login.svg'
@@ -14,6 +14,9 @@ import IOSDownload from '../../assets/img/download/apple.jpg'
export default function Login() {
const { userDetails: { token, room }} = useSelector((state) => state?.userDetails); // CHECKS IF USER Details are avaliable, to determine if user is active
let loggedIn = token && room ? true : false; // variable to determine if user is logged in
const dispatch = useDispatch()
const navigate = useNavigate()
@@ -67,6 +70,12 @@ export default function Login() {
}
}
useEffect(()=>{ // NAVIGATES USER TO HOME PAGE IF USER IS ACTIVE
if(loggedIn){
navigate(siteLinks.dash)
}
},[])
return (
<div className="app">
<div className="app-wrap">