1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-20 14:54:15 +01:00

(bug) unable to update member's profile

This commit is contained in:
Du Peng 2024-04-09 15:43:44 +02:00
parent cab9b143a4
commit 6e5b0f70dc
2 changed files with 6 additions and 0 deletions

View File

@ -2,6 +2,8 @@
## Next release
- Fix a bug: unable to update member's profile
## v6.3.19 2024 Avril 9
- Fix a bug: user is blocked in complete profile page after login

View File

@ -129,6 +129,7 @@ export const UserProfileForm: React.FC<UserProfileFormProps> = ({ action, size,
* Callback triggered when the form is submitted: process with the user creation or update.
*/
const onSubmit = (event: React.FormEvent<HTMLFormElement>) => {
setIsSuccessfullySubmitted(false);
if (showTermsAndConditionsInput) {
// When the form is submitted, we consider that the user should have accepted the terms and conditions,
// so we mark the field as dirty, even if he doesn't touch it. Like that, the error message is displayed.
@ -137,6 +138,9 @@ export const UserProfileForm: React.FC<UserProfileFormProps> = ({ action, size,
return handleSubmit((data: User) => {
['events_reservations', 'space_reservations', 'training_reservations', 'machine_reservations', 'all_projects', 'invoices', 'subscribed_plan', 'subscription'].forEach(key => delete data[key]);
if (!data.password) {
['current_password', 'password', 'password_confirmation'].forEach(key => delete data[key]);
}
MemberAPI[action](data)
.then(res => {
reset(res);