Skip to content

Commit

Permalink
[#48] fixing security vulnerability in npm package and a bug in calli…
Browse files Browse the repository at this point in the history
…ng the api in sucession [cf]
  • Loading branch information
cfech committed Jun 30, 2023
1 parent 82357a5 commit b0f50d8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 18 deletions.
28 changes: 14 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 12 additions & 4 deletions src/components/addressSearchBar/AddressSearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,6 @@ export const AddressSearchBar = ({ isHomePage }: AddressSearchBarProps) => {
console.log(res);
setRepresentativeDataResponse(res.data);
setRepresentativeCallSuccessful(true);

// Call the query for elections API after the representative call is successful
queryAvailableElectionsAPI();
})
.catch((err) => {
// Catch any errors in the api chain
Expand All @@ -120,7 +117,8 @@ export const AddressSearchBar = ({ isHomePage }: AddressSearchBarProps) => {
setSnackBarIsOpen(true);
})
.finally(() => {
setButtonIsDisabled(false);
// Call the query for elections API after the representative call is successful
queryAvailableElectionsAPI();
});
};

Expand All @@ -135,6 +133,16 @@ export const AddressSearchBar = ({ isHomePage }: AddressSearchBarProps) => {
// Setting the state on successful response
setAvailableElections(res.data);
setElectionCallSuccessful(true);
})
.catch((err) => {
console.log(err);
if (!snackBarIsOpen) {
setGoogleApiErrorMessage(err.response.data.error.message);
setSnackBarIsOpen(true);
}
})
.finally(() => {
setButtonIsDisabled(false);
});
};

Expand Down

0 comments on commit b0f50d8

Please sign in to comment.