Skip to content

Commit

Permalink
Run Prettier to format code style
Browse files Browse the repository at this point in the history
  • Loading branch information
TueeNguyen committed Oct 6, 2021
1 parent e5a8cea commit 4112b3d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
26 changes: 14 additions & 12 deletions frontend/src/components/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,23 +93,25 @@ export default function Home() {
}
const headers = {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
}
Authorization: `Bearer ${token}`,
};
fetch(url, {
headers: headers
headers: headers,
})
.then((response) => checkForErrors(response))
.then((data) => setLeads(data.leads))
// TODO: create state for error and set state instead of just console.error
// conditional rendering if there is an error
.catch((error) => console.error(error.message));
.then((response) => checkForErrors(response))
.then((data) => setLeads(data.leads))
// TODO: create state for error and set state instead of just console.error
// conditional rendering if there is an error
.catch((error) => console.error(error.message));

fetch(n_pagesUrl, {
headers: headers
headers: headers,
})
.then((response) => checkForErrors(response))
.then((data) => setMaxPages( Math.ceil(data.pages * data.query.perpage / perpage) ))
.catch((error) => console.error(error.message));
.then((response) => checkForErrors(response))
.then((data) =>
setMaxPages(Math.ceil((data.pages * data.query.perpage) / perpage))
)
.catch((error) => console.error(error.message));
}, [page, perpage, maxpages, search]);

return (
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/components/PaginationControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { DEBOUNCE_TIME_MS } from '../constants';
const useStyles = makeStyles((theme) => ({
paginationTextField: {
width: '115px',
marginLeft: '5px'
marginLeft: '5px',
},
}));

Expand Down Expand Up @@ -67,7 +67,9 @@ export default function PaginationControl({
<Typography>
{page} / {maxpages}
</Typography>
<Button onClick={() => setPage(page + 1 <= maxpages ? page + 1 : maxpages)}>
<Button
onClick={() => setPage(page + 1 <= maxpages ? page + 1 : maxpages)}
>
<ChevronRightIcon></ChevronRightIcon>
</Button>
</Fragment>
Expand Down

0 comments on commit 4112b3d

Please sign in to comment.