mejoras varias en frontend, separacion de intent y state, pick de articulos
This commit is contained in:
@@ -7,6 +7,25 @@ export const api = {
|
||||
return fetch(u).then(r => r.json());
|
||||
},
|
||||
|
||||
async deleteConversation(chat_id) {
|
||||
if (!chat_id) throw new Error("chat_id_required");
|
||||
return fetch(`/conversations/${encodeURIComponent(chat_id)}`, { method: "DELETE" }).then(r => r.json());
|
||||
},
|
||||
|
||||
async users({ q = "", limit = 200 } = {}) {
|
||||
const u = new URL("/users", location.origin);
|
||||
if (q) u.searchParams.set("q", String(q));
|
||||
u.searchParams.set("limit", String(limit));
|
||||
return fetch(u).then(r => r.json());
|
||||
},
|
||||
|
||||
async deleteUser(chat_id, { deleteWoo = false } = {}) {
|
||||
if (!chat_id) throw new Error("chat_id_required");
|
||||
const u = new URL(`/users/${encodeURIComponent(chat_id)}`, location.origin);
|
||||
if (deleteWoo) u.searchParams.set("deleteWoo", "1");
|
||||
return fetch(u, { method: "DELETE" }).then(r => r.json());
|
||||
},
|
||||
|
||||
async messages({ chat_id, limit = 200 } = {}) {
|
||||
const u = new URL("/messages", location.origin);
|
||||
if (chat_id) u.searchParams.set("chat_id", chat_id);
|
||||
@@ -21,6 +40,11 @@ export const api = {
|
||||
return fetch(u).then(r => r.json());
|
||||
},
|
||||
|
||||
async runById(run_id) {
|
||||
if (!run_id) return null;
|
||||
return fetch(`/runs/${encodeURIComponent(run_id)}`).then(r => r.json());
|
||||
},
|
||||
|
||||
async simEvolution(payload) {
|
||||
return fetch("/webhook/evolution", {
|
||||
method: "POST",
|
||||
@@ -28,4 +52,9 @@ export const api = {
|
||||
body: JSON.stringify(payload),
|
||||
}).then(r => r.json());
|
||||
},
|
||||
|
||||
async retryLast(chat_id) {
|
||||
if (!chat_id) throw new Error("chat_id_required");
|
||||
return fetch(`/conversations/${encodeURIComponent(chat_id)}/retry-last`, { method: "POST" }).then(r => r.json());
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user