Skip to content

Commit

Permalink
Add confirmation before accepting or rejecting offer (#861)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ace314159 authored Sep 30, 2021
1 parent 387f1a4 commit 98c3a64
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/client/routes/dashboard/HackerDash.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,23 @@ export const HackerDash: FunctionComponent = (): JSX.Element => {

useEffect((): void => {
statusConfig[ApplicationStatus.Accepted].actions[0].action = () => {
confirmMySpot()
.then(() => setShowConfetti(true))
.catch(err => console.error(err));
// eslint-disable-next-line no-alert
const confirmed = window.confirm('Are you sure you want to confirm your spot?');
if (confirmed) {
confirmMySpot()
.then(() => setShowConfetti(true))
.catch(err => console.error(err));
}
return undefined;
};
statusConfig[ApplicationStatus.Accepted].actions[1].action = () => {
declineMySpot()
// no confetti :(
.catch(err => console.error(err));
// eslint-disable-next-line no-alert
const confirmed = window.confirm('Are you sure you want to decline your spot?');
if (confirmed) {
declineMySpot()
// no confetti :(
.catch(err => console.error(err));
}
return undefined;
};
}, [confirmMySpot, declineMySpot]);
Expand Down

0 comments on commit 98c3a64

Please sign in to comment.