diff options
author | Ivan Chen <ivan@tagg.id> | 2021-03-25 16:11:53 -0400 |
---|---|---|
committer | Ivan Chen <ivan@tagg.id> | 2021-03-25 16:11:53 -0400 |
commit | 3728df66381c77db8fe37032bbddb0a0aca79f2e (patch) | |
tree | 94becfc8ba77621c15bd307ca32c0d0f2aba2d86 | |
parent | 40ae1e53f7e2f5a916a41b785980e24e7a5b4c59 (diff) |
updated to use formdata for register, make university required
-rw-r--r-- | src/constants/strings.ts | 7 | ||||
-rw-r--r-- | src/screens/onboarding/OnboardingStepThree.tsx | 4 | ||||
-rw-r--r-- | src/services/UserProfileService.ts | 19 |
3 files changed, 19 insertions, 11 deletions
diff --git a/src/constants/strings.ts b/src/constants/strings.ts index cb442b7b..66d4a6d9 100644 --- a/src/constants/strings.ts +++ b/src/constants/strings.ts @@ -6,6 +6,7 @@ export const ADD_COMMENT_TEXT = (username?: string) => username ? `Reply to ${us export const COMING_SOON_MSG = 'Creating more fun things for you, surprises coming soon π'; export const ERROR_ATTEMPT_EDIT_SP = 'Can\'t let you do that yet! Please onboard Suggested People first!'; export const ERROR_AUTHENTICATION = 'An error occurred during authentication. Please login again!'; +export const ERROR_BADGES_EXCEED_LIMIT = 'You can\'t have more than 5 badges!'; export const ERROR_CATEGORY_CREATION = 'There was a problem creating your categories. Please refresh and try again.'; export const ERROR_CATEGORY_UPDATE = 'There was a problem updating your categories. Please refresh and try again'; export const ERROR_DELETE_CATEGORY = 'There was a problem while deleting category. Please try again'; @@ -35,6 +36,7 @@ export const ERROR_REGISTRATION = (str: string) => `Registration failed π, ${ export const ERROR_SELECT_BIRTHDAY = 'Please select your birthday'; export const ERROR_SELECT_CLASS_YEAR = 'Please select your Class Year'; export const ERROR_SELECT_GENDER = 'Please select your gender'; +export const ERROR_SELECT_UNIVERSITY = 'Please select your University'; export const ERROR_SERVER_DOWN = 'mhm, looks like our servers are down, please refresh and try again in a few mins'; export const ERROR_SOMETHING_WENT_WRONG = 'Oh dear, donβt worry someone will be held responsible for this error, In the meantime refresh the app'; export const ERROR_SOMETHING_WENT_WRONG_REFRESH = "Ha, looks like this one's on us, please refresh and try again"; @@ -44,21 +46,20 @@ export const ERROR_UNABLE_TO_FIND_PROFILE = 'We were unable to find this profile export const ERROR_UNABLE_TO_VIEW_PROFILE = 'Unable to view this profile'; export const ERROR_UPLOAD = 'An error occurred while uploading. Please try again!'; export const ERROR_UPLOAD_BADGES = 'Unable to upload your badges. Please retry!'; -export const ERROR_BADGES_EXCEED_LIMIT = 'You can\'t have more than 5 badges!'; export const ERROR_UPLOAD_LARGE_PROFILE_PIC = "Can't have the first image seen on the profile be blank, please upload a large picture"; export const ERROR_UPLOAD_MOMENT = 'Unable to upload moment. Please retry'; -export const ERROR_UPLOAD_SP_PHOTO = 'Unable to update suggested people photo. Please retry!'; export const ERROR_UPLOAD_SMALL_PROFILE_PIC = "Can't have a profile without a pic to represent you, please upload a small profile picture"; +export const ERROR_UPLOAD_SP_PHOTO = 'Unable to update suggested people photo. Please retry!'; export const ERROR_VERIFICATION_FAILED_SHORT = 'Verification failed π'; export const MARKED_AS_MSG = (str: string) => `Marked as ${str}`; export const MOMENT_DELETED_MSG = 'Moment deleted....Some moments have to go, to create space for greater ones'; export const NO_NEW_NOTIFICATIONS = 'You have no new notifications'; export const NO_RESULTS_FOUND = 'No Results Found!'; +export const SUCCESS_BADGES_UPDATE = 'Badges updated successfully!' export const SUCCESS_CATEGORY_DELETE = 'Category successfully deleted, but its memory will live on'; export const SUCCESS_INVITATION_CODE = 'Welcome to Tagg!'; export const SUCCESS_LINK = (str: string) => `Successfully linked ${str} π`; export const SUCCESS_PIC_UPLOAD = 'Beautiful, the picture was uploaded successfully!'; -export const SUCCESS_BADGES_UPDATE = 'Badges updated successfully!' export const SUCCESS_PWD_RESET = 'Your password was reset successfully!'; export const SUCCESS_VERIFICATION_CODE_SENT = 'New verification code sent! Check your phone messages for your code'; export const UP_TO_DATE = 'Up-to-Date!'; diff --git a/src/screens/onboarding/OnboardingStepThree.tsx b/src/screens/onboarding/OnboardingStepThree.tsx index dffdf2fe..120380c1 100644 --- a/src/screens/onboarding/OnboardingStepThree.tsx +++ b/src/screens/onboarding/OnboardingStepThree.tsx @@ -158,6 +158,10 @@ const OnboardingStepThree: React.FC<OnboardingStepThreeProps> = ({ Alert.alert(ERROR_SELECT_CLASS_YEAR); return; } + if (form.university === '') { + Alert.alert(ERROR_SELECT_UNIVERSITY); + return; + } if (form.birthdate === emptyDate) { Alert.alert(ERROR_SELECT_BIRTHDAY); return; diff --git a/src/services/UserProfileService.ts b/src/services/UserProfileService.ts index 041dd4c3..a5b42814 100644 --- a/src/services/UserProfileService.ts +++ b/src/services/UserProfileService.ts @@ -340,16 +340,19 @@ export const sendRegister = async ( password: string, ) => { try { + const form = new FormData() + form.append('first_name', firstName) + form.append('last_name', lastName) + form.append('email', email) + form.append('phone_number', phone) + form.append('username', username) + form.append('password', password) const response = await fetch(REGISTER_ENDPOINT, { method: 'POST', - body: JSON.stringify({ - first_name: firstName, - last_name: lastName, - email: email, - phone_number: phone, - username: username, - password: password, - }), + headers: { + 'Content-Type': 'multipart/form-data', + }, + body: form }); return response; } catch (error) { |