import { useState } from 'react'; import { useRouter } from 'next/router'; import Link from 'next/link'; import Head from 'next/head'; import { useAuth } from '../hooks/useAuth'; export default function RegisterPage() { const [name, setName] = useState(''); const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [error, setError] = useState(''); const [licenseKey, setLicenseKey] = useState(''); const [loading, setLoading] = useState(false); const { register } = useAuth(); const router = useRouter(); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setError(''); setLoading(true); try { const result = await register(email, password, name); setLicenseKey(result.licenseKey); } catch (err: any) { setError(err.response?.data?.message || 'Registration failed'); } setLoading(false); }; if (licenseKey) { return ( <> Registrasi Berhasil – MarketScope
🎉

Registrasi Berhasil!

Simpan license key ini untuk Chrome Extension:

{licenseKey}

Masukkan key ini di Chrome Extension untuk mengaktifkan fitur scanning.

); } return ( <> Register – MarketScope
M

MarketScope

Create Account

{error && (
{error}
)}
setName(e.target.value)} className="input-field" placeholder="Your name" required />
setEmail(e.target.value)} className="input-field" placeholder="you@example.com" required />
setPassword(e.target.value)} className="input-field" placeholder="Min 8 characters" required minLength={8} />

Sudah punya akun? Login

); }