Skip to content

Commit

Permalink
Address CR: Move state.error messages from ui to console
Browse files Browse the repository at this point in the history
  • Loading branch information
scopalaffairs committed Oct 11, 2023
1 parent 4ad87e2 commit 8e36bc7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/Recommender/Service/RecommendedUsers.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ if (state.isLoading) {
getRecommendedUsers(state.currentPage);
}

if (state.error) {
console.error("Error, try again later", state.error);
}

const handleFollowed = (accountId) => {
const updatedUsers = state.displayedUsers.filter(
(user) => (user.recommended_profile || user.similar_profile) !== accountId
Expand All @@ -141,7 +145,6 @@ const handleFollowed = (accountId) => {
return (
<RecommendedUsers>
{state.isLoading && <p>Loading...</p>}
{state.error && <p>Error: {state.error}</p>}
<Profiles>
{!state.isLoading && state.displayedUsers.length < 4 ? (
<>
Expand Down
5 changes: 4 additions & 1 deletion src/Recommender/Views/FriendsOfFriends.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,13 @@ if (state.isLoading) {
getRecommendedUsers(state.currentPage);
}

if (state.error) {
console.error("Error, try again later", state.error);
}

return (
<RecommendedUsers>
{state.isLoading && <p>Loading...</p>}
{state.error && <p>Error: {state.error}</p>}
<Profiles>
{!state.isLoading && displayedUsers.length < 4 ? (
<>
Expand Down
5 changes: 4 additions & 1 deletion src/Recommender/Views/SimilarProfiles.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,13 @@ if (state.isLoading) {
getRecommendedUsers(state.currentPage);
}

if (state.error) {
console.error("Error, try again later", state.error);
}

return (
<RecommendedUsers>
{state.isLoading && <p>Loading...</p>}
{state.error && <p>Error: {state.error}</p>}
<Profiles>
{!state.isLoading && displayedUsers.length < 4 ? (
<>
Expand Down
5 changes: 4 additions & 1 deletion src/Recommender/Views/TrendingUsersView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,13 @@ if (state.isLoading) {
getRecommendedUsers(state.currentPage);
}

if (state.error) {
console.error("Error, try again later", state.error);
}

return (
<RecommendedUsers>
{state.isLoading && displayedUsers.length == null && <p>Loading...</p>}
{state.error && <p>Error: {state.error}</p>}
{(displayedUsers.length < 4 || displayedUsers == null) &&
state.isLoading &&
(props.scope == "friends" || props.scope === "similar") && (
Expand Down

0 comments on commit 8e36bc7

Please sign in to comment.