Stabilisiere WhatsApp-Verbindung
This commit is contained in:
@@ -47,12 +47,15 @@
|
||||
};
|
||||
|
||||
async function update() {
|
||||
const statusEl = document.getElementById('status');
|
||||
const msgEl = document.getElementById('msg');
|
||||
try {
|
||||
const response = await fetch(getBaseUrl() + 'api/status');
|
||||
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
||||
const data = await response.json();
|
||||
|
||||
const statusEl = document.getElementById('status');
|
||||
const qrSection = document.getElementById('qr-section');
|
||||
msgEl.innerText = data.lastError || '';
|
||||
|
||||
if (data.isReady) {
|
||||
statusEl.innerText = "VERBUNDEN ✅";
|
||||
@@ -67,6 +70,10 @@
|
||||
statusEl.innerText = "LADE CLIENT... ⏳";
|
||||
statusEl.className = "status-badge loading";
|
||||
qrSection.style.display = "none";
|
||||
} else if (data.lastError) {
|
||||
statusEl.innerText = `NEUVERBINDUNG (${data.reconnectAttempts}) ⏳`;
|
||||
statusEl.className = "status-badge loading";
|
||||
qrSection.style.display = "none";
|
||||
} else {
|
||||
statusEl.innerText = "INITIALISIERE...";
|
||||
statusEl.className = "status-badge loading";
|
||||
@@ -75,6 +82,7 @@
|
||||
} catch (e) {
|
||||
statusEl.innerText = "VERBINDUNG VERLOREN ❌";
|
||||
statusEl.className = "status-badge disconnected";
|
||||
msgEl.innerText = e.message;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,4 +107,4 @@
|
||||
update();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user