Add persona unpublish and market preview
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user