diff --git a/src/component/Profile/profilePage.css b/src/component/Profile/profilePage.css index 604fa33..2e8265c 100644 --- a/src/component/Profile/profilePage.css +++ b/src/component/Profile/profilePage.css @@ -1146,3 +1146,10 @@ font-size: 0.9rem; width: 78vw; } } + + +/* Used to display user not found message */ +.not-found{ + color: rgb(71, 200, 122, 0.9); + text-align: center; +} \ No newline at end of file diff --git a/src/component/Profile/profilePage.jsx b/src/component/Profile/profilePage.jsx index adb1e12..419898e 100644 --- a/src/component/Profile/profilePage.jsx +++ b/src/component/Profile/profilePage.jsx @@ -82,7 +82,9 @@ function ProfilePage() { useEffect(() => { // When the component mounts, call showTweets to display the tweets - showTweets(); + + //ensuring that tweets arent shown when the user doesnt exist(could lead to errors and hence the if condition) + if(accessProfile) showTweets(); dispatch(ProfileAction(apiname)); }, [apiname]); @@ -182,6 +184,24 @@ function ProfilePage() { return formattedDate; } + /* Used to display user not found message */ + if(!accessProfile) return ( + <> + + {loading === true ? :
+
+ Avatar +
+
+

User @{apiname} not found ☹️

+
+
+
+
} + + ) + + return ( <>