modificando el patron del sistema, orientado mas al usuario
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { api } from "../lib/api.js";
|
||||
import { emit, on } from "../lib/bus.js";
|
||||
import { modal } from "../lib/modal.js";
|
||||
|
||||
class ConversationsCrud extends HTMLElement {
|
||||
constructor() {
|
||||
@@ -244,21 +245,22 @@ class ConversationsCrud extends HTMLElement {
|
||||
this.shadowRoot.getElementById("retryLast").onclick = async () => {
|
||||
try {
|
||||
await api.retryLast(c.chat_id);
|
||||
alert("Retry ejecutado");
|
||||
modal.success("Retry ejecutado");
|
||||
} catch (e) {
|
||||
alert("Error: " + (e.message || e));
|
||||
modal.error("Error: " + (e.message || e));
|
||||
}
|
||||
};
|
||||
|
||||
this.shadowRoot.getElementById("deleteConv").onclick = async () => {
|
||||
if (!confirm(`¿Eliminar la conversacion de "${c.chat_id}"?`)) return;
|
||||
const confirmed = await modal.confirm(`¿Eliminar la conversación de "${c.chat_id}"?`);
|
||||
if (!confirmed) return;
|
||||
try {
|
||||
await api.deleteConversation(c.chat_id);
|
||||
this.selected = null;
|
||||
await this.load();
|
||||
this.renderDetail();
|
||||
} catch (e) {
|
||||
alert("Error: " + (e.message || e));
|
||||
modal.error("Error: " + (e.message || e));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user