Add persona unpublish and market preview

This commit is contained in:
2026-01-14 19:42:17 +01:00
parent 53d353b5ff
commit ce8683776d
5 changed files with 222 additions and 2 deletions
+14
View File
@@ -306,6 +306,14 @@ function renderPersonaList(personaItems, activeId, listElement, personaType) {
publishBtn.textContent = isPublished ? 'Update listing' : 'Publish';
publishBtn.addEventListener('click', () => publishPersona(persona.id));
if (isPublished) {
const unpublishBtn = document.createElement('button');
unpublishBtn.type = 'button';
unpublishBtn.textContent = 'Unpublish';
unpublishBtn.addEventListener('click', () => unpublishPersona(persona.id));
actions.appendChild(unpublishBtn);
}
const deleteBtn = document.createElement('button');
deleteBtn.type = 'button';
deleteBtn.textContent = 'Delete';
@@ -402,6 +410,12 @@ async function publishPersona(personaId) {
await loadPersonas();
}
async function unpublishPersona(personaId) {
const res = await post(`/personas/${personaId}/unpublish`, {});
if (res.error) return;
await loadPersonas();
}
function setLoadingState(loading) {
isProcessing = loading;
sendBtn.disabled = loading;