From dc594f6d01f6ba0f8a6044318725020941f84ea7 Mon Sep 17 00:00:00 2001 From: Alejandro Guzman Date: Thu, 14 Dec 2023 23:06:39 +0100 Subject: [PATCH] Minor changes --- src/components/UserProfile.jsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/UserProfile.jsx b/src/components/UserProfile.jsx index cb136cd..221cef1 100644 --- a/src/components/UserProfile.jsx +++ b/src/components/UserProfile.jsx @@ -532,7 +532,6 @@ const UserProfile = () => { }, [userFollowers]); const checkIfFollowed = (username) => { - // Verifica si el usuario actual está siguiendo a 'username' return userFollowing.includes(username); }; @@ -553,12 +552,19 @@ const UserProfile = () => { throw new Error(`Failed to ${isCurrentlyFollowed ? 'unfollow' : 'follow'} user`); } - // Actualizar el estado local setMyFollowing(prevFollowing => { return isCurrentlyFollowed ? prevFollowing.filter(user => user !== username) : [...prevFollowing, username]; }); + + if(myUserName===userName){ + setUserFollowing(prevFollowing => { + return isCurrentlyFollowed + ? prevFollowing.filter(user => user !== username) + : [...prevFollowing, username]; + }) + } } catch (error) { console.error('Error:', error); }