diff --git a/app/api/helpers.js b/app/api/helpers.js
index dadd206..c5f20ff 100644
--- a/app/api/helpers.js
+++ b/app/api/helpers.js
@@ -33,6 +33,11 @@ export const formatPostData = (body) => {
return postData;
};
+export const formatJsonData = (body) => {
+ console.log('formateJsonBody:', body);
+ return body; //JSON.stringify(body);
+};
+
const parseQueryParamsString = (queryParams) => {
if (typeof queryParams !== 'string') {
return null;
diff --git a/app/api/index.js b/app/api/index.js
index b31a991..dd4085f 100644
--- a/app/api/index.js
+++ b/app/api/index.js
@@ -1,6 +1,7 @@
import {
constructUrl,
formatPostData,
+ formatJsonData,
parseQueryParams,
request,
unwrapJson,
@@ -74,9 +75,15 @@ export const requestPost = (options) => {
queryParams = [],
requestOptions = {},
isFormattedPostData = false,
+ shouldUseFormData = false,
} = options;
const params = parseQueryParams(queryParams || []);
+ let postData = isFormattedPostData ? body : null;
+
+ if (!postData) {
+ postData = shouldUseFormData ? formatPostData(body) : formatJsonData(body);
+ }
if (params === null) {
throw new Error('invalid queryParams');
@@ -88,7 +95,7 @@ export const requestPost = (options) => {
...DefaultRequestOptions,
...requestOptions,
method: 'POST',
- body: isFormattedPostData ? body : formatPostData(body),
+ body: postData,
})
.then(validateResponse)
.then(unwrapJson);
diff --git a/app/api/profile.js b/app/api/profile.js
index 28bc3d3..7ca9d6b 100644
--- a/app/api/profile.js
+++ b/app/api/profile.js
@@ -1,7 +1,7 @@
import { API_ENDPOINTS, requestGet, requestPost } from './index.js';
export const getEmailAvailability = (email) =>
- requestGet(`${API_ENDPOINTS.VALIDATE_SIGNUP_EMAIL}/&{encodeURI(email)}`);
+ requestGet(`${API_ENDPOINTS.VALIDATE_SIGNUP_EMAIL}/${encodeURI(email)}`);
export const getNomAvailaibility = (nomDeBid) =>
requestGet(`${API_ENDPOINTS.VALIDATE_SIGNUP_NOM}/${encodeURI(nomDeBid)}`);
diff --git a/app/components/Profile/EditNomDeBid.js b/app/components/Profile/EditNomDeBid.js
index 305772b..b06f15f 100644
--- a/app/components/Profile/EditNomDeBid.js
+++ b/app/components/Profile/EditNomDeBid.js
@@ -22,21 +22,21 @@ export default function EditNomDeBid({
updateNomDeBid,
}) {
const [newNom, setNomDeBid] = useState(isGeneratedNomDeBid || !nomDeBid ? '' : nomDeBid);
- const [isNomValid, setValidNom] = useState(false);
+ const [isNomValid, setValidNom] = useState(null);
- const _handleEndEditing = (nomDeBid) => {
- getNomAvailaibility(nomDeBid).then((result) => {
+ const _handleEndEditing = () => {
+ getNomAvailaibility(newNom).then((result) => {
setValidNom(result.available);
if (isStandalone) {
- updateNomDeBid({ nomDeBid });
+ updateNomDeBid(newNom);
}
});
};
const _handleSubmitNom = () => {
if (isNomValid) {
- updateNomDeBid({ newNom });
+ updateNomDeBid(newNom);
}
};
@@ -48,12 +48,19 @@ export default function EditNomDeBid({
{explanationString}
setNomDeBid(text)}
- onEndEditing={(text) => _handleEndEditing(text)}
+ onEndEditing={() => _handleEndEditing()}
placeholder="nom de bid"
style={[styles.textInput, styles.requiredInput]}
value={newNom}
/>
+ {isNomValid === false && (
+ Nom De Bid is taken!
+ )}
+ {isNomValid === true && (
+ Nom De Bid is available!
+ )}
{!isStandalone && (
);
}
diff --git a/app/components/Profile/PhoneInput/PhoneListItem.js b/app/components/Profile/PhoneInput/PhoneListItem.js
index 52810bd..6420511 100644
--- a/app/components/Profile/PhoneInput/PhoneListItem.js
+++ b/app/components/Profile/PhoneInput/PhoneListItem.js
@@ -9,12 +9,12 @@ export default function PhoneListItem({ index, label, number, handleDelete, hand
return (
- {phone.get('number')}
- {phone.get('label')}
+ {number}
+ {label}
- {handleEdit !== null && this.handleEditStart(index)} />}
- this.props.handleDelete(index)} />
+ {handleEdit !== null && handleEditStart(index)} />}
+ handleDelete(index)} />
);
diff --git a/app/components/Profile/Profile.js b/app/components/Profile/Profile.js
index 287efca..ea115e8 100644
--- a/app/components/Profile/Profile.js
+++ b/app/components/Profile/Profile.js
@@ -7,6 +7,7 @@ import ViewProfile from './ViewProfile.container.js';
export default function Profile({
cancelEditAction,
+ isGuidedRegistration,
isInEditMode,
saveProfileAction,
saveProfileLabel,
@@ -28,6 +29,7 @@ export default function Profile({
{editMode ? (
@@ -40,12 +42,14 @@ export default function Profile({
Profile.propTypes = {
cancelEditAction: PropTypes.func.isRequired,
+ isGuidedRegistration: PropTypes.bool,
isInEditMode: PropTypes.bool,
saveProfileAction: PropTypes.func.isRequired,
saveProfileLabel: PropTypes.string,
};
Profile.defaultProps = {
+ isGuidedRegistration: false,
isInEditMode: false,
saveProfileLabel: null,
};
diff --git a/app/components/Profile/Profile.styles.js b/app/components/Profile/Profile.styles.js
index d22edfb..87b7e29 100644
--- a/app/components/Profile/Profile.styles.js
+++ b/app/components/Profile/Profile.styles.js
@@ -12,9 +12,9 @@ export default StyleSheet.create({
sectionWrap: {
marginBottom: 15,
},
- avatarWrap: {
+ emailWrap: {
marginBottom: 40,
- marginTop: 30,
+ marginTop: 20,
textAlign: 'center',
},
groupHeading: {
diff --git a/app/constants/constants.js b/app/constants/constants.js
index d7c9129..b64677e 100644
--- a/app/constants/constants.js
+++ b/app/constants/constants.js
@@ -52,10 +52,10 @@ export const PERMISSIONS = {
FACEBOOK: ['email', 'public_profile'],
};
-export const PHONE_TYPES = {
- HOME: { label: 'home', value: 'home' },
- MOBILE: { label: 'mobile', value: 'mobile' },
- WORK: { label: 'work', value: 'work' },
-};
+export const PHONE_TYPES = [
+ { label: 'home', value: 'home' },
+ { label: 'mobile', value: 'mobile' },
+ { label: 'work', value: 'work' },
+];
-export const PHONE_TYPE_DEFAULT = PHONE_TYPES.HOME.value;
+export const PHONE_TYPE_DEFAULT = PHONE_TYPES[0].value;
diff --git a/app/screens/Register.js b/app/screens/Register.js
index 68619ed..2ae96e6 100644
--- a/app/screens/Register.js
+++ b/app/screens/Register.js
@@ -22,6 +22,7 @@ export default function Register({ doRegistration, navigation }) {
{title}
navigation.goBack()}
+ isGuided
saveProfileAction={_doRegistration}
saveProfileLabel="Register"
showPasswordEntry