Migrate to local PG & Update Solana Checkout

This commit is contained in:
2026-03-12 19:22:10 +03:00
parent e7f9325b1c
commit 321f25a15c
16 changed files with 1445 additions and 4980 deletions

View File

@@ -1,7 +1,6 @@
'use client';
import { useState } from 'react';
import { createClient } from '@/utils/supabase/client';
import { useRouter } from 'next/navigation';
import { Lock, Mail, Loader2, Wallet } from 'lucide-react';
@@ -11,24 +10,29 @@ export default function LoginPage() {
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState<string | null>(null);
const router = useRouter();
const supabase = createClient();
const handleLogin = async (e: React.FormEvent) => {
e.preventDefault();
setIsLoading(true);
setError(null);
const { error } = await supabase.auth.signInWithPassword({
email,
password,
});
try {
const res = await fetch('/api/auth/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email, password })
});
const data = await res.json();
if (error) {
setError(error.message);
if (!res.ok) {
setError(data.error || 'Login failed');
} else {
router.push('/admin');
router.refresh();
}
} catch (err: any) {
setError('Bir ağ hatası oluştu, lütfen tekrar deneyin.');
} finally {
setIsLoading(false);
} else {
router.push('/admin');
router.refresh();
}
};