From 8a55a28ba96f744cf7dab716b13742cd43c64e7e Mon Sep 17 00:00:00 2001 From: TAKAHASHI Shuuji Date: Sun, 3 Mar 2024 19:10:00 +0900 Subject: [PATCH] fix: ensure to clear the draft after posting --- composables/masto/publish.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/composables/masto/publish.ts b/composables/masto/publish.ts index 71bec9d7..8c0b22f9 100644 --- a/composables/masto/publish.ts +++ b/composables/masto/publish.ts @@ -119,14 +119,7 @@ export function usePublish(options: { let status: mastodon.v1.Status if (!draftItem.value.editingStatus) { status = await client.value.v1.statuses.create(payload) - - if (scheduledAt) - // When created a scheduled post, it returns `mastodon.v1.ScheduledStatus` instead - // We want to return only Status, which will be used to route to the posted status page - // ref. Mastodon documentation - https://docs.joinmastodon.org/methods/statuses/#create - return } - else { status = await client.value.v1.statuses.$select(draftItem.value.editingStatus.id).update({ ...payload, @@ -141,6 +134,12 @@ export function usePublish(options: { draftItem.value = options.initialDraft() + if (scheduledAt) + // When created a scheduled post, it returns `mastodon.v1.ScheduledStatus` instead + // We want to return only Status, which will be used to route to the posted status page + // ref. Mastodon documentation - https://docs.joinmastodon.org/methods/statuses/#create + return + return status } catch (err) {