import { useState } from 'react'; import { doSetup } from '../api.js'; export default function SetupPage({ onComplete }) { const [username, setUsername] = useState(''); const [password, setPassword] = useState(''); const [confirm, setConfirm] = useState(''); const [error, setError] = useState(null); const [loading, setLoading] = useState(false); async function handleSubmit(e) { e.preventDefault(); if (password !== confirm) { setError('Passwords do not match'); return; } if (password.length < 8) { setError('Password must be at least 8 characters'); return; } setError(null); setLoading(true); try { await doSetup(username, password); onComplete(); } catch (err) { setError(err.message); } finally { setLoading(false); } } return (
Create your owner account to get started.