diff options
Diffstat (limited to 'src/services/UserProfileService.ts')
-rw-r--r-- | src/services/UserProfileService.ts | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/services/UserProfileService.ts b/src/services/UserProfileService.ts index c1901be1..1ce1d0b5 100644 --- a/src/services/UserProfileService.ts +++ b/src/services/UserProfileService.ts @@ -92,11 +92,11 @@ export const updateProfileVisibility = async ( try { const url = EDIT_PROFILE_ENDPOINT + `${user.userId}/`; const request = new FormData(); - request.append('is_private', isPrivateAccount); + request.append('is_private', isPrivateAccount ? 'True' : 'False'); let response = await fetch(url, { method: 'PATCH', headers: { - 'Content-Type': 'application/json', + 'Content-Type': 'multipart/form-data', Authorization: 'Token ' + token, }, body: request, @@ -104,7 +104,7 @@ export const updateProfileVisibility = async ( const {status} = response; let data = await response.json(); if (status === 200) { - dispatch(loadUserData(user)); + await dispatch(loadUserData(user)); } else if (status >= 400) { Alert.alert( ERROR_PROFILE_UPDATE_SHORT, @@ -112,6 +112,7 @@ export const updateProfileVisibility = async ( ); } } catch (error) { + debugger; Alert.alert(ERROR_PROFILE_UPDATE_SHORT, ERROR_DOUBLE_CHECK_CONNECTION); return { name: 'Profile update error', |