Admin login
Sign in to access the publish admin page.
);
}
window.LoginPage = LoginPage;
function PublishPage({ onGo }) {
const [title, setTitle] = useState('');
const [content, setContent] = useState('');
const [loading, setLoading] = useState(false);
const [msg, setMsg] = useState(null);
async function handleSubmit(e) {
e.preventDefault();
setMsg(null);
setLoading(true);
try {
// default proxy path assumes Vercel deployment at project root
const res = await publishViaProxy({ title, content }, '/api/publish');
setMsg({ type: 'success', text: `Published (ID ${res.id})` });
setTitle(''); setContent('');
} catch (err) {
console.error(err);
setMsg({ type: 'error', text: err.message || 'Publish failed' });
} finally {
setLoading(false);
}
}
return (