Page logicgit add .

This commit is contained in:
alma 2025-04-21 11:05:31 +02:00
parent 440a637c18
commit 219c46ef9b
2 changed files with 8 additions and 23 deletions

View File

@ -1,7 +1,13 @@
import { Metadata } from "next";
export const metadata: Metadata = {
title: "Enkun - Connexion",
};
export default function SignInLayout({
children,
}: {
children: React.ReactNode;
}) {
return <>{children}</>;
return children;
}

View File

@ -1,35 +1,14 @@
"use client";
import { Metadata } from "next";
import { getServerSession } from "next-auth/next";
import { authOptions } from "@/app/api/auth/[...nextauth]/route";
import { redirect } from "next/navigation";
import { SignInForm } from "@/components/auth/signin-form";
import { signIn } from "next-auth/react";
import { useRouter } from "next/navigation";
import { useState } from "react";
import { initializeNextcloudStructure } from "@/lib/nextcloud-init";
export const metadata: Metadata = {
title: "Enkun - Connexion",
};
export default async function SignIn({
searchParams,
}: {
searchParams: { callbackUrl?: string };
}) {
const session = await getServerSession(authOptions);
export default function SignIn() {
const router = useRouter();
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState<string | null>(null);
// If user is already authenticated and there's no specific callback URL,
// redirect to the home page
if (session && !searchParams.callbackUrl) {
redirect("/");
}
const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
setIsLoading(true);