From 4eee957ba5768eae01f9b569005f969525f4e736 Mon Sep 17 00:00:00 2001 From: Shuaige1234567 Date: Thu, 14 Dec 2023 18:29:35 +0800 Subject: [PATCH] =?UTF-8?q?follow=E4=B9=8B=E5=90=8E=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E6=B6=88=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/routes/profile.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/frontend/src/routes/profile.tsx b/frontend/src/routes/profile.tsx index 49e48b9..840b411 100644 --- a/frontend/src/routes/profile.tsx +++ b/frontend/src/routes/profile.tsx @@ -54,11 +54,15 @@ export default function UserProfile() { } }, [userid]) - useEffect(() => { - - me && principal && userApi.isFollowed(me, principal).then(e => { + const isFollow = async () => { + if (me && principal) { + const e = await userApi.isFollowed(me, principal) setIsFollowed(e) - }) + } + } + + useEffect(() => { + isFollow() }, [me, principal]) @@ -125,6 +129,7 @@ export default function UserProfile() { icon: }) await userApi.follow(principal); + await isFollow() api.success({ message: 'Follow Successful !', key: 'follow',