return res.json( available: true ); ); import useState, useEffect from 'react'; import debounce from 'lodash'; export default function KamalogamUsernameField( onUsernameChange ) const [username, setUsername] = useState(''); const [status, setStatus] = useState(null); // 'checking', 'available', 'unavailable' const [message, setMessage] = useState('');
// 2. Check reserved list const reserved = await db.query( 'SELECT 1 FROM kamalogam_reserved_usernames WHERE name = $1', [username.toLowerCase()] ); if (reserved.rows.length > 0) return res.json( available: false, reason: 'This username is reserved.' ); kamalogam user name
const checkAvailability = debounce(async (value) => value.length < 3) setStatus(null); return; setStatus('checking'); const res = await fetch('/api/check-username', method: 'POST', headers: 'Content-Type': 'application/json' , body: JSON.stringify( username: value ) ); const data = await res.json(); if (data.available) setStatus('available'); setMessage('✅ Username is available!'); onUsernameChange(value); else setStatus('unavailable'); setMessage(`❌ $data.reason`); onUsernameChange(null); , 500); return res
Data controller: ROLLING SCORES, S.L. [Paseo de Mikeletegi 53-2º, 20009 Donostia-San Sebastián (Spain) / contact@blackbinder.net]. Purpose: We will use your contact data to keep you updated by email about Blackbinder’s latest news, events, promotions and activities from time to time. Legal basis: Your consent. You can unsubscribe from our newsletter at any time by clicking on the unsubscribe option you will find in our emails or sending us an opt-out email. Recipients: We will not share your data with third parties. We use an email marketing service located in the US (Mailchimp) who complies with the EU-US Privacy Shield standards; you can check Mailchimp’s privacy terms here. Your rights: Among others, you have the right to access and rectify your data, object or restrict the processing of your data for some purposes or request it to be deleted, as detailed in our Privacy Policy. More information: Check our full Privacy Policy here.