mirror of
https://github.com/elk-zone/elk.git
synced 2024-09-06 12:19:08 +01:00
feat: refresh context after post
This commit is contained in:
parent
f7a3d9c401
commit
12bb0bbb2d
3 changed files with 6 additions and 2 deletions
|
@ -19,6 +19,8 @@ const {
|
||||||
expanded?: boolean
|
expanded?: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits(['published'])
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
// eslint-disable-next-line prefer-const
|
// eslint-disable-next-line prefer-const
|
||||||
let { draft, isEmpty } = $(useDraft(draftKey, initial))
|
let { draft, isEmpty } = $(useDraft(draftKey, initial))
|
||||||
|
@ -128,6 +130,7 @@ async function publish() {
|
||||||
|
|
||||||
draft = initial()
|
draft = initial()
|
||||||
isPublishDialogOpen.value = false
|
isPublishDialogOpen.value = false
|
||||||
|
emit('published')
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
isSending = false
|
isSending = false
|
||||||
|
|
|
@ -14,10 +14,10 @@ export function setCached(key: string, value: any, override = false) {
|
||||||
cache.set(key, value)
|
cache.set(key, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function fetchStatus(id: string): Promise<Status> {
|
export function fetchStatus(id: string, force = false): Promise<Status> {
|
||||||
const key = `status:${id}`
|
const key = `status:${id}`
|
||||||
const cached = cache.get(key)
|
const cached = cache.get(key)
|
||||||
if (cached)
|
if (cached && !force)
|
||||||
return cached
|
return cached
|
||||||
const promise = useMasto().statuses.fetch(id)
|
const promise = useMasto().statuses.fetch(id)
|
||||||
.then((status) => {
|
.then((status) => {
|
||||||
|
|
|
@ -68,6 +68,7 @@ onReactivated(() => {
|
||||||
:draft-key="replyDraft!.key"
|
:draft-key="replyDraft!.key"
|
||||||
:initial="replyDraft!.draft"
|
:initial="replyDraft!.draft"
|
||||||
border="t base"
|
border="t base"
|
||||||
|
@published="refreshContext()"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<template v-if="context">
|
<template v-if="context">
|
||||||
|
|
Loading…
Reference in a new issue