Some more

This commit is contained in:
Sir Blob
2025-01-26 02:54:42 -05:00
parent e9b0f9d7c7
commit 4a29e300cf
3 changed files with 10 additions and 17 deletions

View File

@@ -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 (