Saving settings and reloading the page to select the invitation account
This commit is contained in:
parent
51eb54954f
commit
2358c7d8fb
|
@ -90,6 +90,11 @@ const Invitation: Component<props> = (props) => {
|
|||
mail: user.mail,
|
||||
};
|
||||
dispatch({ action: 'putAccount', params: { id, account } });
|
||||
const settings: any = await dispatch({ action: 'getSettings' });
|
||||
dispatch({
|
||||
action: 'putSettings',
|
||||
params: { settings: { ...settings, currentAccountId: id } },
|
||||
});
|
||||
} catch (error) {
|
||||
setInvitation({
|
||||
...invitation(),
|
||||
|
@ -106,8 +111,9 @@ const Invitation: Component<props> = (props) => {
|
|||
setInvitation({ ...invitation(), failure: undefined, existing: undefined });
|
||||
};
|
||||
|
||||
const handleCloseAll = () => {
|
||||
const handleCloseSuccess = () => {
|
||||
setInvitation(false);
|
||||
location.reload();
|
||||
};
|
||||
|
||||
return (
|
||||
|
@ -146,7 +152,7 @@ const Invitation: Component<props> = (props) => {
|
|||
<Button variant='outlined' onClick={fetchInvitation}>
|
||||
Renvoyer le code
|
||||
</Button>
|
||||
<Button variant='outlined' color='error' onClick={handleCloseAll}>
|
||||
<Button variant='outlined' color='error' onClick={handleCloseSuccess}>
|
||||
Annuler
|
||||
</Button>
|
||||
</Box>
|
||||
|
@ -174,7 +180,7 @@ const Invitation: Component<props> = (props) => {
|
|||
</Modal>{' '}
|
||||
<Modal
|
||||
open={!!invitation().success}
|
||||
onClose={handleCloseAll}
|
||||
onClose={handleCloseSuccess}
|
||||
aria-labelledby='modal-modal-title'
|
||||
aria-describedby='modal-modal-description'
|
||||
>
|
||||
|
|
Loading…
Reference in New Issue