Skip to content

Commit

Permalink
fix: inconsistent mapper level label on user profile page
Browse files Browse the repository at this point in the history
  • Loading branch information
kaditya97 committed Nov 7, 2023
1 parent 5b895a4 commit 17c9842
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions frontend/src/views/userDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { CountriesMapped } from '../components/userDetail/countriesMapped';
import { TopProjects } from '../components/userDetail/topProjects';
import { ContributionTimeline } from '../components/userDetail/contributionTimeline';
import { NotFound } from './notFound';
import { OHSOME_STATS_BASE_URL } from '../config';
import { OHSOME_STATS_BASE_URL, OSM_SERVER_URL } from '../config';
import { fetchExternalJSONAPI } from '../network/genericJSONRequest';
import { useFetch } from '../hooks/UseFetch';
import { useSetTitleTag } from '../hooks/UseMetaTags';
Expand All @@ -33,6 +33,7 @@ export const UserDetail = ({ withHeader = true }) => {
const token = useSelector((state) => state.auth.token);
const currentUser = useSelector((state) => state.auth.userDetails);
const [osmStats, setOsmStats] = useState({});
const [userOsmDetails, setUserOsmDetails] = useState({});
const [errorDetails, loadingDetails, userDetails] = useFetch(
`users/queries/${username}/`,
username !== undefined,
Expand All @@ -54,6 +55,9 @@ export const UserDetail = ({ withHeader = true }) => {

useEffect(() => {
if (userDetails.id) {
fetchExternalJSONAPI(`${OSM_SERVER_URL}/api/0.6/user/${userDetails.id}.json`, false)
.then((res) => setUserOsmDetails(res?.user))
.catch((e) => console.log(e));
fetchExternalJSONAPI(`${OHSOME_STATS_BASE_URL}/hot-tm-user?userId=${userDetails.id}`, true)
.then((res) => setOsmStats(res.result))
.catch((e) => console.log(e));
Expand All @@ -74,7 +78,7 @@ export const UserDetail = ({ withHeader = true }) => {
rows={5}
ready={!errorDetails && !loadingDetails}
>
<HeaderProfile userDetails={userDetails} changesets={osmStats.changesets} />
<HeaderProfile userDetails={userDetails} changesets={userOsmDetails?.changesets?.count} />
</ReactPlaceholder>
</div>
)}
Expand Down

0 comments on commit 17c9842

Please sign in to comment.