From 149cdb53fe2282259e64ae49d9ecaec86f5c9b5f Mon Sep 17 00:00:00 2001 From: Vojtech Simetka Date: Thu, 4 May 2023 22:05:48 +0200 Subject: [PATCH] feat: disable publishing several personas --- .../src/routes/persona/draft/[id]/+page.svelte | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/ui/src/routes/persona/draft/[id]/+page.svelte b/packages/ui/src/routes/persona/draft/[id]/+page.svelte index 047b1d89..bcd5ab0b 100644 --- a/packages/ui/src/routes/persona/draft/[id]/+page.svelte +++ b/packages/ui/src/routes/persona/draft/[id]/+page.svelte @@ -49,6 +49,7 @@ let postToEditImages: string[] = [] let postToDelete: DraftPost | undefined = undefined let publishedPersonaId: string | undefined = undefined + let publishing = false type State = 'persona_preview' | 'edit_text' | 'edit_rep' | 'post_new' | 'publish_warning' @@ -75,10 +76,16 @@ } async function publishPersona() { - if (!$profile.signer) return + try { + publishing = true + if (!$profile.signer) throw new Error('No signer, please login') - publishedPersonaId = await adapter.publishPersona(persona, $profile.signer) - adapter.addPersonaToFavorite(publishedPersonaId) + publishedPersonaId = await adapter.publishPersona(persona, $profile.signer) + adapter.addPersonaToFavorite(publishedPersonaId) + } catch (e) { + console.error(e) + } + publishing = false } let y: number @@ -397,11 +404,12 @@ {#if $tokens.go >= TOKEN_POST_COST} -