mirror of
https://github.com/elk-zone/elk.git
synced 2024-12-18 17:11:56 +03:00
fix: ensure to clear the draft after posting
This commit is contained in:
parent
4b1ceccd85
commit
31d85bb6fd
1 changed files with 6 additions and 7 deletions
|
@ -118,14 +118,7 @@ export function usePublish(options: {
|
||||||
let status: mastodon.v1.Status
|
let status: mastodon.v1.Status
|
||||||
if (!draftItem.value.editingStatus) {
|
if (!draftItem.value.editingStatus) {
|
||||||
status = await client.value.v1.statuses.create(payload)
|
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 {
|
else {
|
||||||
status = await client.value.v1.statuses.$select(draftItem.value.editingStatus.id).update({
|
status = await client.value.v1.statuses.$select(draftItem.value.editingStatus.id).update({
|
||||||
...payload,
|
...payload,
|
||||||
|
@ -140,6 +133,12 @@ export function usePublish(options: {
|
||||||
|
|
||||||
draftItem.value = options.initialDraft()
|
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
|
return status
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
|
|
Loading…
Reference in a new issue