Ignore:
Timestamp:
02/07/26 14:59:57 (5 months ago)
Author:
Filip Gavrilovski <filipgavrilovski28@…>
Branches:
main
Children:
ebdd3d4
Parents:
591919d
Message:

fix bug that prevented unauthenticated users to see top songs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • frontend/src/App.tsx

    r591919d r5938bc9  
    44import "react-toastify/dist/ReactToastify.css";
    55import Sidebar from "./components/Sidebar";
     6import { useAuth } from "./context/authContext";
    67import AllUsers from "./pages/AllUsers";
    78import LandingPage from "./pages/LandingPage";
     
    1213import UserDetail from "./pages/UserDetail";
    1314
    14 const Layout = () => {
    15         const [isSidebarOpen, setIsSidebarOpen] = useState(true);
     15const MainLayout = () => {
     16        const { user } = useAuth();
     17        const [isSidebarOpen, setIsSidebarOpen] = useState(!!user);
    1618
    1719        return (
     
    4345                </div>
    4446        );
     47};
     48
     49const Layout = () => {
     50        const { isAuthLoading } = useAuth();
     51
     52        if (isAuthLoading) {
     53                return (
     54                        <div className="flex h-screen items-center justify-center bg-[#121212]">
     55                                <div className="w-12 h-12 border-4 border-white/10 border-t-[#1db954] rounded-full animate-spin"></div>
     56                        </div>
     57                );
     58        }
     59
     60        return <MainLayout />;
    4561};
    4662
Note: See TracChangeset for help on using the changeset viewer.