From 1275c41bd2a29bf2c0910e4908be1f6d46473421 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Fri, 13 Jan 2023 23:00:35 +0800 Subject: [PATCH] refactor(account): adjust notify button --- components/account/AccountHeader.vue | 25 +++++++++----------- package.json | 2 +- pnpm-lock.yaml | 35 +++++++++++++++++++--------- 3 files changed, 36 insertions(+), 26 deletions(-) diff --git a/components/account/AccountHeader.vue b/components/account/AccountHeader.vue index 496327e6..cddc3c3b 100644 --- a/components/account/AccountHeader.vue +++ b/components/account/AccountHeader.vue @@ -44,17 +44,14 @@ function previewAvatar() { } async function toggleNotify() { - // @ts-expect-error: Masto.js only recently added this field. Can be removed when Elk updates Masto.js to 5.4.0 or higher. - relationship!.notifying = !relationship?.notifying + relationship!.notifying = !relationship!.notifying try { - // @ts-expect-error: Masto.js only recently added this field. Can be removed when Elk updates Masto.js to 5.4.0 or higher. - const newRel = await masto.v1.accounts.follow(account.id, { notify: relationship?.notifying }) + const newRel = await masto.v1.accounts.follow(account.id, { notify: relationship!.notifying }) Object.assign(relationship!, newRel) } catch { // TODO error handling - // @ts-expect-error: Masto.js only recently added this field. Can be removed when Elk updates Masto.js to 5.4.0 or higher. - relationship!.notifying = !relationship?.notifying + relationship!.notifying = !relationship!.notifying } } @@ -79,8 +76,6 @@ watchEffect(() => { }) const isSelf = $computed(() => currentUser.value?.account.id === account.id) -// @ts-expect-error: Masto.js only recently added this field. Can be removed when Elk updates Masto.js to 5.4.0 or higher. -const isAlertedOnPost = $computed(() => relationship?.notifying)