mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-28 12:43:11 +10:00
Fix profile image in contact details update
Add profile image include param to update email and phone number requests.
This commit is contained in:
parent
e1c76c9f20
commit
82bdb327d2
1 changed files with 17 additions and 6 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import merge from 'lodash/merge';
|
||||
import { denormalisedResponseEntities } from '../../util/data';
|
||||
import { storableError } from '../../util/errors';
|
||||
import { currentUserShowSuccess } from '../../ducks/user.duck';
|
||||
|
||||
|
|
@ -77,10 +78,15 @@ const requestSavePhoneNumber = params => (dispatch, getState, sdk) => {
|
|||
const phoneNumber = params.phoneNumber;
|
||||
|
||||
return sdk.currentUser
|
||||
.updateProfile({ protectedData: { phoneNumber } }, { expand: true })
|
||||
.updateProfile({ protectedData: { phoneNumber } }, { expand: true, include: ['profileImage'] })
|
||||
.then(response => {
|
||||
// return user
|
||||
return response.data.data;
|
||||
const entities = denormalisedResponseEntities(response);
|
||||
if (entities.length !== 1) {
|
||||
throw new Error('Expected a resource in the sdk.currentUser.updateProfile response');
|
||||
}
|
||||
|
||||
const currentUser = entities[0];
|
||||
return currentUser;
|
||||
})
|
||||
.catch(e => {
|
||||
dispatch(savePhoneNumberError(storableError(e)));
|
||||
|
|
@ -97,10 +103,15 @@ const requestSaveEmail = params => (dispatch, getState, sdk) => {
|
|||
const { email, currentPassword } = params;
|
||||
|
||||
return sdk.currentUser
|
||||
.changeEmail({ email, currentPassword }, { expand: true })
|
||||
.changeEmail({ email, currentPassword }, { expand: true, include: ['profileImage'] })
|
||||
.then(response => {
|
||||
// return user
|
||||
return response.data.data;
|
||||
const entities = denormalisedResponseEntities(response);
|
||||
if (entities.length !== 1) {
|
||||
throw new Error('Expected a resource in the sdk.currentUser.changeEmail response');
|
||||
}
|
||||
|
||||
const currentUser = entities[0];
|
||||
return currentUser;
|
||||
})
|
||||
.catch(e => {
|
||||
dispatch(saveEmailError(storableError(e)));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue