diff --git a/src/app/me/page.tsx b/src/app/me/page.tsx index 046c7e1..70f611b 100644 --- a/src/app/me/page.tsx +++ b/src/app/me/page.tsx @@ -1,19 +1,14 @@ import { getUser } from "@/auth"; import { getUserInfo } from "@/ldap"; import AboutMe from "./AboutMe"; +import { redirect } from "next/navigation"; export default async function Page() { const user = await getUser(); - if (!user) { - window.location.href = "/login"; - return; - } + if (!user) redirect("/login"); const info = await getUserInfo(user); - if (info === null) { - window.location.href = "/login"; - return; - } + if (info === null) redirect("/login"); return ; } diff --git a/src/app/register/page.tsx b/src/app/register/page.tsx index 85353b6..60489f7 100644 --- a/src/app/register/page.tsx +++ b/src/app/register/page.tsx @@ -1,14 +1,12 @@ import { cookies } from "next/dist/client/components/headers"; import styles from "@/app/page.module.css"; import RegisterForm from "./RegisterForm"; +import { redirect } from "next/navigation"; export default function Page() { const cookieStore = cookies(); const ticket = cookieStore.get("ticket"); - if (ticket === null) { - window.location.href = "/"; - return; - } + if (ticket === null) redirect("/"); return (