Saving settings and reloading the page to select the invitation account

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

View File

@ -90,6 +90,11 @@ const Invitation: Component<props> = (props) => {
mail: user.mail, mail: user.mail,
}; };
dispatch({ action: 'putAccount', params: { id, account } }); dispatch({ action: 'putAccount', params: { id, account } });
const settings: any = await dispatch({ action: 'getSettings' });
dispatch({
action: 'putSettings',
params: { settings: { ...settings, currentAccountId: id } },
});
} catch (error) { } catch (error) {
setInvitation({ setInvitation({
...invitation(), ...invitation(),
@ -106,8 +111,9 @@ const Invitation: Component<props> = (props) => {
setInvitation({ ...invitation(), failure: undefined, existing: undefined }); setInvitation({ ...invitation(), failure: undefined, existing: undefined });
}; };
const handleCloseAll = () => { const handleCloseSuccess = () => {
setInvitation(false); setInvitation(false);
location.reload();
}; };
return ( return (
@ -146,7 +152,7 @@ const Invitation: Component<props> = (props) => {
<Button variant='outlined' onClick={fetchInvitation}> <Button variant='outlined' onClick={fetchInvitation}>
Renvoyer le code Renvoyer le code
</Button> </Button>
<Button variant='outlined' color='error' onClick={handleCloseAll}> <Button variant='outlined' color='error' onClick={handleCloseSuccess}>
Annuler Annuler
</Button> </Button>
</Box> </Box>
@ -174,7 +180,7 @@ const Invitation: Component<props> = (props) => {
</Modal>{' '} </Modal>{' '}
<Modal <Modal
open={!!invitation().success} open={!!invitation().success}
onClose={handleCloseAll} onClose={handleCloseSuccess}
aria-labelledby='modal-modal-title' aria-labelledby='modal-modal-title'
aria-describedby='modal-modal-description' aria-describedby='modal-modal-description'
> >