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',