Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit fcb88c0

Browse files
authoredJul 24, 2020
Merge pull request #568 from topcoder-platform/issues/timor/66
fixes issue#66
2 parents 6bce5c8 + a0378fc commit fcb88c0

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed
 

‎client/src/pages/Search/Global.jsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,19 @@ export default function SearchGlobal({ keyword }) {
260260
setWindowWidth(window.innerWidth);
261261
};
262262

263+
/**
264+
* Sets the new page number and gets the new set of users
265+
* @param {Number} newPageNumber The new page number
266+
*/
267+
const onChangePage = async (newPageNumber) => {
268+
if (window) {
269+
window.scrollTo({
270+
top: 0,
271+
});
272+
}
273+
searchContext.changePageNumber(newPageNumber);
274+
};
275+
263276
const onWholeContentClick = (evt) => {
264277
if (dropdownRef.current && !dropdownRef.current.contains(evt.target)) {
265278
setSortByDropdownShown(false);
@@ -346,7 +359,11 @@ export default function SearchGlobal({ keyword }) {
346359
})}
347360
</div>
348361
<div>
349-
<Pagination currentPage={page} numPages={totalPages} />
362+
<Pagination
363+
currentPage={page}
364+
numPages={totalPages}
365+
onChangePage={onChangePage}
366+
/>
350367
</div>
351368
</div>
352369
)}

‎client/src/pages/Search/Groups.jsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ export default function SearchGroups() {
129129
* @param {Number} newPageNumber The new page number
130130
*/
131131
const onChangePage = async (newPageNumber) => {
132+
if (window) {
133+
window.scrollTo({
134+
top: 0,
135+
});
136+
}
132137
setPage(newPageNumber);
133138
await getMembersInGroup(selectedGroup.id, newPageNumber);
134139
};

‎client/src/services/api.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ export default () => {
3333
await loginWithRedirect({
3434
redirect_uri: window.location.origin,
3535
});
36-
} else if (
37-
error.response &&
38-
error.response.data.message
39-
) {
36+
} else if (error.response && error.response.data.message) {
4037
const modError = new Error(error.response.data.message);
4138
return Promise.reject(modError);
4239
}

0 commit comments

Comments
 (0)
This repository has been archived.