Skip to content

Commit

Permalink
Removing unnecessary math to calculate maxpages
Browse files Browse the repository at this point in the history
  • Loading branch information
TueeNguyen committed Oct 6, 2021
1 parent 4112b3d commit d0c1b7a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions frontend/src/components/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default function Home() {

useEffect(() => {
let url = `${API_HOST}/leads?page=${page}&perpage=${perpage}`;
const n_pagesUrl = `${API_HOST}/leads/n_pages`;
const n_pagesUrl = `${API_HOST}/leads/n_pages?perpage=${perpage}`;
if (search) {
url += `&search=${search}`;
}
Expand All @@ -108,9 +108,7 @@ export default function Home() {
headers: headers,
})
.then((response) => checkForErrors(response))
.then((data) =>
setMaxPages(Math.ceil((data.pages * data.query.perpage) / perpage))
)
.then((data) => setMaxPages(data.pages))
.catch((error) => console.error(error.message));
}, [page, perpage, maxpages, search]);

Expand Down

0 comments on commit d0c1b7a

Please sign in to comment.