Update telegram.html

This commit is contained in:
Lizandro Guarnizo
2026-05-22 00:03:06 -05:00
parent d8cbf70593
commit c21fab079d
+11 -11
View File
@@ -281,24 +281,24 @@ function telegramApp() {
}, },
async testConfig(cfg) { async testConfig(cfg) {
this.$set(this.testLoading, cfg.ID, true); this.testLoading[cfg.ID] = true;
this.$set(this.testResult, cfg.ID, ''); this.testResult[cfg.ID] = '';
const res = await fetch(`/app/telegram/${cfg.ID}/test`, { method: 'POST' }); const res = await fetch(`/app/telegram/${cfg.ID}/test`, { method: 'POST' });
const d = await res.json(); const d = await res.json();
this.$set(this.testOk, cfg.ID, d.ok); this.testOk[cfg.ID] = d.ok;
this.$set(this.testResult, cfg.ID, d.ok ? '✅ Mensaje enviado correctamente.' : ('❌ ' + (d.error || 'Error'))); this.testResult[cfg.ID] = d.ok ? '✅ Mensaje enviado correctamente.' : ('❌ ' + (d.error || 'Error'));
this.$set(this.testLoading, cfg.ID, false); this.testLoading[cfg.ID] = false;
}, },
async setWebhook(cfg) { async setWebhook(cfg) {
this.$set(this.webhookLoading, cfg.ID, true); this.webhookLoading[cfg.ID] = true;
this.$set(this.webhookResult, cfg.ID, ''); this.webhookResult[cfg.ID] = '';
const res = await fetch(`/app/telegram/${cfg.ID}/set-portal-webhook`, { method: 'POST' }); const res = await fetch(`/app/telegram/${cfg.ID}/set-portal-webhook`, { method: 'POST' });
const d = await res.json(); const d = await res.json();
this.$set(this.webhookOk, cfg.ID, d.ok); this.webhookOk[cfg.ID] = d.ok;
this.$set(this.webhookResult, cfg.ID, d.ok this.webhookResult[cfg.ID] = d.ok
? '✅ Webhook registrado: ' + (d.webhook_url || '') ? '✅ Webhook registrado: ' + (d.webhook_url || '')
: '❌ Error: ' + (d.telegram?.description || d.error || 'Error desconocido')); : '❌ Error: ' + (d.telegram?.description || d.error || 'Error desconocido');
this.$set(this.webhookLoading, cfg.ID, false); this.webhookLoading[cfg.ID] = false;
}, },
async sendMessage() { async sendMessage() {