41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
"use client";
|
|
|
|
import { supabase } from "@/integrations/supabase/client";
|
|
import { Auth } from "@supabase/auth-ui-react";
|
|
import { ThemeSupa } from "@supabase/auth-ui-shared";
|
|
import { useEffect } from "react";
|
|
import { useRouter } from "next/navigation";
|
|
import type { AuthChangeEvent, Session } from "@supabase/supabase-js";
|
|
|
|
export default function LoginPage() {
|
|
const router = useRouter();
|
|
|
|
useEffect(() => {
|
|
const { data: { subscription } } = supabase.auth.onAuthStateChange((_event: AuthChangeEvent, session: Session | null) => {
|
|
if (session) {
|
|
router.push('/');
|
|
}
|
|
});
|
|
|
|
return () => subscription.unsubscribe();
|
|
}, [router]);
|
|
|
|
return (
|
|
<div className="flex items-center justify-center min-h-screen bg-background">
|
|
<div className="w-full max-w-md p-8 space-y-8">
|
|
<div>
|
|
<h1 className="text-3xl font-bold text-center">Welcome Back</h1>
|
|
<p className="text-center text-muted-foreground">Sign in to continue to the Video Editor</p>
|
|
</div>
|
|
<Auth
|
|
supabaseClient={supabase}
|
|
appearance={{ theme: ThemeSupa }}
|
|
providers={[]}
|
|
theme="dark"
|
|
view="sign_in"
|
|
showLinks={true}
|
|
/>
|
|
</div>
|
|
</div>
|
|
);
|
|
} |