generated from ctc-uci/npo-frontend-vite-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 201-refactor-sidebar-1
- Loading branch information
Showing
20 changed files
with
588 additions
and
363 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { | ||
Button, | ||
Text, | ||
Stack, | ||
Modal, | ||
ModalContent, | ||
ModalBody, | ||
ModalOverlay, | ||
ModalCloseButton, | ||
} from '@chakra-ui/react'; | ||
import Backend from '../../utils/utils'; | ||
import PropTypes from 'prop-types'; | ||
|
||
const CancelFlowController = ({id, isOpen, onClose}) => { | ||
const unregisterFromEvent = async (id) => { | ||
console.log(id) | ||
// Register for event | ||
try { | ||
const route = '/data/' + id | ||
await Backend.delete(route); | ||
onClose(); | ||
} catch (e) { | ||
console.log('Error deleting event data entry', e); | ||
} | ||
// Added this to update the page / no longer show unregistered events | ||
window.location.reload(false); | ||
}; | ||
return ( | ||
<Modal isOpen={isOpen} onClose={onClose}> | ||
<ModalOverlay /> | ||
<ModalContent> | ||
<ModalCloseButton /> | ||
<ModalBody> | ||
<Stack align="center" padding="1rem" gap="2rem"> | ||
<Text fontSize="2xl" align="center">Are you sure you want to cancel your registration?</Text> | ||
<Button onClick={() => unregisterFromEvent(id)}>Confirm Cancellation</Button> | ||
</Stack> | ||
</ModalBody> | ||
</ModalContent> | ||
</Modal> | ||
); | ||
} | ||
|
||
CancelFlowController.propTypes = { | ||
isOpen: PropTypes.bool, | ||
onClose: PropTypes.func, | ||
id: PropTypes.number, | ||
}; | ||
|
||
export default CancelFlowController; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.