import { useState } from 'react'; import { Button } from './ui/button'; import { Card, CardContent } from './ui/card'; import { Input } from './ui/input'; import { Label } from './ui/label'; import { useSession } from '../lib/auth-client'; const logo = '/logo.png'; interface Props { onComplete: () => void; } export function Onboarding({ onComplete }: Props) { const { data: session } = useSession(); const [piFirstName, setPiFirstName] = useState(''); const [bldgCode, setBldgCode] = useState(''); const [lab, setLab] = useState(''); const [contact, setContact] = useState(''); const [error, setError] = useState(''); const [loading, setLoading] = useState(false); async function handleSubmit(e: React.FormEvent) { e.preventDefault(); setError(''); setLoading(true); const res = await fetch('/api/profile', { method: 'POST', headers: { 'Content-Type': 'application/json' }, credentials: 'include', body: JSON.stringify({ pi_first_name: piFirstName, bldg_code: bldgCode, lab, contact: contact || undefined, }), }); setLoading(false); if (res.ok) { onComplete(); } else { const data = await res.json(); setError(data.error || 'Failed to save profile'); } } return (
Set up your lab details. These will be used as defaults when adding inventory.