From 4a29e300cfa377cb730ac1fbc3d374519c520cb7 Mon Sep 17 00:00:00 2001 From: Sir Blob <76974209+GamerBoss101@users.noreply.github.com> Date: Sun, 26 Jan 2025 02:54:42 -0500 Subject: [PATCH] Some more --- src/app/(panels)/suite/layout.jsx | 11 +++++------ src/app/(web)/login/page.jsx | 7 +++++-- src/app/(web)/page.jsx | 9 --------- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/src/app/(panels)/suite/layout.jsx b/src/app/(panels)/suite/layout.jsx index 51a05bb..a78e6ee 100644 --- a/src/app/(panels)/suite/layout.jsx +++ b/src/app/(panels)/suite/layout.jsx @@ -2,12 +2,14 @@ import { useState, useEffect } from "react"; import { useUser } from "@clerk/nextjs"; +import { useRouter } from 'next/navigation' import axios from "axios"; export default function RootLayout({ children, }) { + const router = useRouter(); const { user } = useUser(); const [userData, setUserData] = useState(null); @@ -21,15 +23,12 @@ export default function RootLayout({ if (userData) { if (userData.role === "caregiver") { - window.location.href = "suite/doctor/dashboard"; + router.push("/suite/doctor/dashboard"); } if (userData.role === "patient") { - window.location.href = "suite/patient/dashboard"; + router.push("/suite/patient/dashboard"); } - } else { - window.location.href = "/"; - } - + } return ( diff --git a/src/app/(web)/login/page.jsx b/src/app/(web)/login/page.jsx index 37023a2..5bdce3f 100644 --- a/src/app/(web)/login/page.jsx +++ b/src/app/(web)/login/page.jsx @@ -5,6 +5,8 @@ import { useState, useEffect } from "react"; import axios from "axios"; import { useUser } from "@clerk/nextjs"; +import { useRouter } from 'next/navigation' + import { SignInButton, SignedOut, @@ -15,6 +17,7 @@ import { Button } from "@/components/ui/button" export default function LoginPage() { + const router = useRouter(); const { user } = useUser(); const [userData, setUserData] = useState(null); @@ -28,10 +31,10 @@ export default function LoginPage() { if (userData) { if (userData.role === "caregiver") { - window.location.href = "suite/doctor/dashboard"; + router.push("/suite/doctor/dashboard"); } if (userData.role === "patient") { - window.location.href = "suite/patient/dashboard"; + router.push("/suite/patient/dashboard"); } } diff --git a/src/app/(web)/page.jsx b/src/app/(web)/page.jsx index 17325aa..a578661 100644 --- a/src/app/(web)/page.jsx +++ b/src/app/(web)/page.jsx @@ -3,20 +3,11 @@ import { Hero } from "@/components/hero"; import { HeroOne } from "@/components/heroOne"; -import Link from "next/link"; - export default function Home() { return (
- - -
- - - -
); } \ No newline at end of file