feat(auth): Add authorize page

This commit is contained in:
Björn Benouarets
2026-01-21 06:40:53 +01:00
parent 74232ad2d2
commit 9e7841ee35
8 changed files with 90 additions and 38 deletions

View File

@@ -1,13 +1,26 @@
import { cookies } from "next/headers";
import { redirect } from "next/navigation";
import { LoginContainer, LoginSuccessContainer } from "@/components/core/login-form";
// Get the url before redirect to this page
export interface HomeParams {
returnTo?: string;
}
export default async function Home() {
export default async function Home({
searchParams
}: {
searchParams: Promise<HomeParams>
}) {
const params = await searchParams;
const cookieStore = await cookies();
const token = cookieStore.get("token");
// If token exists and we came from a redirect, go back
if (token && params.returnTo) {
redirect(params.returnTo);
}
if (token) {
return (
<div className="flex justify-center items-center h-screen">