fix: show recording state on first click, fix error state via WS

This commit is contained in:
2026-04-01 13:57:41 +02:00
parent d60d6bb1be
commit 629341930e
+4 -2
View File
@@ -55,7 +55,9 @@ function setStatus(status) {
btn.addEventListener('click', async () => { btn.addEventListener('click', async () => {
const r = await apiFetch('/toggle', { method: 'POST' }); const r = await apiFetch('/toggle', { method: 'POST' });
const data = await r.json(); const data = await r.json();
if (data.action === 'reset') { if (data.action === 'started') {
setStatus('recording');
} else if (data.action === 'reset') {
preview.textContent = 'Noch keine Aufnahme verarbeitet.'; preview.textContent = 'Noch keine Aufnahme verarbeitet.';
preview.classList.remove('has-content'); preview.classList.remove('has-content');
setStatus('idle'); setStatus('idle');
@@ -78,7 +80,7 @@ function connectWs() {
loadTranscripts(); loadTranscripts();
} }
if (msg.event === 'error') { if (msg.event === 'error') {
setStatus('idle'); setStatus('error');
preview.textContent = `Fehler: ${msg.message}`; preview.textContent = `Fehler: ${msg.message}`;
} }
}; };