fix: show recording state on first click, fix error state via WS
This commit is contained in:
+4
-2
@@ -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}`;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user