feat: add error snackbar for updating role mappings

This commit is contained in:
kasia.oczkowska
2024-10-10 13:34:40 +01:00
parent 623ec66a79
commit 2981fa5946
2 changed files with 14 additions and 1 deletions

View File

@@ -56,6 +56,19 @@ function RoleMappings({ provider, providerLoading }) {
});
}
} catch (error) {
const errors = Object.values(
error.response.data.errors || [['Failed while saving!']],
);
for (const [error] of errors) {
enqueueSnackbar(error, {
variant: 'error',
SnackbarProps: {
'data-test': 'snackbar-update-role-mappings-error',
},
});
}
throw new Error('Failed while saving!');
}
};

View File

@@ -66,10 +66,10 @@ function RoleMappingsFieldArray() {
<MuiTextField
{...params}
label={formatMessage('roleMappingsForm.role')}
required
/>
)}
loading={isRolesLoading}
required
/>
</Stack>
<IconButton