Page logicgit add .
This commit is contained in:
parent
440a637c18
commit
219c46ef9b
@ -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;
|
||||
}
|
||||
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user