aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/constants/api.ts1
-rw-r--r--src/screens/onboarding/ProfileOnboarding.tsx9
2 files changed, 7 insertions, 3 deletions
diff --git a/src/constants/api.ts b/src/constants/api.ts
index e3dacccc..e4fed13e 100644
--- a/src/constants/api.ts
+++ b/src/constants/api.ts
@@ -4,6 +4,7 @@ const API_URL: string = BASE_URL + 'api/';
export const LOGIN_ENDPOINT: string = API_URL + 'login/';
export const LOGOUT_ENDPOINT: string = API_URL + 'logout/';
export const REGISTER_ENDPOINT: string = API_URL + 'register/';
+export const EDIT_PROFILE_ENDPOINT: string = API_URL + 'edit-profile/';
export const SEND_OTP_ENDPOINT: string = API_URL + 'send-otp/';
export const VERIFY_OTP_ENDPOINT: string = API_URL + 'verify-otp/';
export const PROFILE_INFO_ENDPOINT: string = API_URL + 'user-profile-info/';
diff --git a/src/screens/onboarding/ProfileOnboarding.tsx b/src/screens/onboarding/ProfileOnboarding.tsx
index ea045434..814cd82e 100644
--- a/src/screens/onboarding/ProfileOnboarding.tsx
+++ b/src/screens/onboarding/ProfileOnboarding.tsx
@@ -21,7 +21,7 @@ import {OnboardingStackParams} from '../../routes/onboarding';
import {AuthContext} from '../../routes/authentication';
import ImagePicker from 'react-native-image-crop-picker';
import {
- REGISTER_ENDPOINT,
+ EDIT_PROFILE_ENDPOINT,
websiteRegex,
bioRegex,
genderRegex,
@@ -312,7 +312,7 @@ const ProfileOnboarding: React.FC<ProfileOnboardingProps> = ({route}) => {
return;
}
- const endpoint = REGISTER_ENDPOINT + `${userId}/`;
+ const endpoint = EDIT_PROFILE_ENDPOINT + `${userId}/`;
try {
let response = await fetch(endpoint, {
method: 'PATCH',
@@ -326,7 +326,10 @@ const ProfileOnboarding: React.FC<ProfileOnboardingProps> = ({route}) => {
if (statusCode === 200) {
login(userId, username);
} else if (statusCode === 400) {
- Alert.alert('Profile update failed. 😔', `${data}`);
+ Alert.alert(
+ 'Profile update failed. 😔',
+ data.error || 'Something went wrong! 😭',
+ );
} else {
Alert.alert(
'Something went wrong! 😭',