fix: update cache + timeline when items are updated/deleted (#556)

This commit is contained in:
Daniel Roe 2022-12-25 15:52:37 +01:00 committed by GitHub
parent 720b5114af
commit dc76ab2477
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 15 deletions

View file

@ -36,6 +36,7 @@ const toggleTranslation = async () => {
isLoading.translation = false
}
const masto = useMasto()
const copyLink = async (status: Status) => {
const url = getStatusPermalinkRoute(status)
if (url)
@ -50,9 +51,10 @@ const deleteStatus = async () => {
return
}
await useMasto().statuses.remove(status.id)
removeCachedStatus(status.id)
await masto.statuses.remove(status.id)
if (route.name === '@account-status')
if (route.name === 'status')
router.back()
// TODO when timeline, remove this item
@ -67,7 +69,8 @@ const deleteAndRedraft = async () => {
return
}
const { text } = await useMasto().statuses.remove(status.id)
removeCachedStatus(status.id)
const { text } = await masto.statuses.remove(status.id)
openPublishDialog('dialog', await getDraftFromStatus(status, text), true)
}