- web/src/*.ts: the script that was inline in index.html and login.html, split along its existing sections. Still one scope, concatenated in order, not modules. - web/build.mjs strips the types, puts the script in the page and minifies it with swc; build.rs runs it into OUT_DIR and web.rs include_str!s the result. 137 KB -> 106 KB. - npx tsc -p . type-checks web/src, loosely; the handful of annotations it needed change no behaviour. - The Docker build installs node and swc (npm ci --omit=dev). - Two list requests racing no longer let the older one win, and switching tabs clears the selection it closes, which made a browser test flaky. Closes #23, #24. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
16 lines
544 B
TypeScript
16 lines
544 B
TypeScript
document.getElementById('f').onsubmit = async e => {
|
|
e.preventDefault();
|
|
const msg = document.getElementById('msg');
|
|
msg.textContent = '';
|
|
const r = await fetch('/api/login', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({
|
|
name: (document.getElementById('name') as HTMLInputElement).value,
|
|
password: (document.getElementById('pw') as HTMLInputElement).value,
|
|
}),
|
|
});
|
|
if (r.ok) location.href = '/';
|
|
else msg.textContent = await r.text() || 'Sign in failed';
|
|
};
|