aboutsummaryrefslogtreecommitdiff
path: root/src/services/UserProfileService.ts
diff options
context:
space:
mode:
authorankit-thanekar007 <ankit.thanekar007@gmail.com>2021-03-25 16:14:29 -0700
committerankit-thanekar007 <ankit.thanekar007@gmail.com>2021-03-29 12:07:23 -0700
commit57a06ec668a24118dd2bbfef149be71d79acf94c (patch)
treefc0fa649c4a7d8d5d8f200b94714a3d3a1d28153 /src/services/UserProfileService.ts
parent7a521127177838bcae0cd85b2e5bd912c46406b9 (diff)
Refactoring changes
Diffstat (limited to 'src/services/UserProfileService.ts')
-rw-r--r--src/services/UserProfileService.ts7
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',