Skip to content

Commit 68a4499

Browse files
authored
Merge pull request #1200 from data-for-change/1195-add-async-functionality
add async to handleApproveButton
2 parents 91abce8 + d0991d2 commit 68a4499

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

src/components/organisms/LocationApproveWindow.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,21 @@ const LocationApprove: FC<IProps> = ({ isOpen, onClose, news, newFlashTitle }) =
6565
const userInfo = userStore.userInfo && userStore.userInfo.data && userStore.userInfo.data.firstName ?
6666
userStore.userInfo.data.firstName.concat(userStore.userInfo.data.lastName) : null;
6767

68-
function handleApproveButton () {
69-
if (shouldApprove && locationChanged) {
70-
if (newStreetLoc) {
71-
updateNews(news.id, locationQualificationOptions.MANUAL, newStreetLoc, null);
72-
} else {
73-
updateNews(news.id, locationQualificationOptions.MANUAL, null, newGpsLoc);
74-
}
75-
} else if (shouldApprove) {
76-
updateNews(news.id, locationQualificationOptions.VERIFIED, null, null);
68+
async function handleApproveButton() {
69+
if (shouldApprove && locationChanged) {
70+
if (newStreetLoc) {
71+
await updateNews(news.id, locationQualificationOptions.MANUAL, newStreetLoc, null);
7772
} else {
78-
updateNews(news.id, locationQualificationOptions.REJECTED, null, null);
73+
await updateNews(news.id, locationQualificationOptions.MANUAL, null, newGpsLoc);
7974
}
80-
onCloseInitValues();
81-
window.location.reload();
75+
} else if (shouldApprove) {
76+
await updateNews(news.id, locationQualificationOptions.VERIFIED, null, null);
77+
} else {
78+
await updateNews(news.id, locationQualificationOptions.REJECTED, null, null);
8279
}
80+
onCloseInitValues();
81+
window.location.reload();
82+
}
8383

8484
const handleCloseButton = () => onCloseInitValues();
8585

0 commit comments

Comments
 (0)