Some more
This commit is contained in:
@@ -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 (
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,20 +3,11 @@
|
||||
import { Hero } from "@/components/hero";
|
||||
import { HeroOne } from "@/components/heroOne";
|
||||
|
||||
import Link from "next/link";
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<div className="items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 font-[family-name:var(--font-geist-sans)]">
|
||||
|
||||
<Hero />
|
||||
<HeroOne />
|
||||
|
||||
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100vh' }}>
|
||||
<Link href="/transcribe">
|
||||
<button>Go to Transcribe Page</button>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user