Adding a check for existing accounts

This commit is contained in:
Eric van der Vlist 2023-03-04 12:10:09 +01:00
parent a32faaa837
commit 51eb54954f
1 changed files with 27 additions and 1 deletions

View File

@ -28,6 +28,7 @@ const fetchInvitation = () => {
params: { id: invitation().data.id },
}).then((account) => {
console.log({ caller: 'Invitation / fetchInvitation', account });
setInvitation({ ...invitation(), existing: true });
});
})
.catch((error) => {
@ -102,7 +103,7 @@ const Invitation: Component<props> = (props) => {
};
const handleModalFailureClose = () => {
setInvitation({ ...invitation(), failure: undefined });
setInvitation({ ...invitation(), failure: undefined, existing: undefined });
};
const handleCloseAll = () => {
@ -191,6 +192,31 @@ const Invitation: Component<props> = (props) => {
>
<Alert severity='success'>C'est tout bon !</Alert>
</Box>
</Modal>{' '}
<Modal
open={!!invitation().existing}
onClose={handleModalFailureClose}
aria-labelledby='modal-modal-title'
aria-describedby='modal-modal-description'
>
<Box
sx={{
position: 'absolute',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
width: 400,
border: '2px solid #000',
boxShadow: '24px',
p: 4,
}}
>
<Alert severity='info'>
Ce compte est déjà configuré, vous pouvez soit continuer et le
reconfigurer soit abandonner cette action et ne pas tenir compte du
massage qui vous a é envoyé.
</Alert>
</Box>
</Modal>
</>
);