feat(#169): added missin region input field (#17)

keep-around/af30b88d367751c9e05a735e4a0467a96238ef47
Mirlan 6 years ago committed by GitHub
parent c205528de6
commit 5f152d7b40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      src/features/Register/components/RegistrationStep/config.tsx
  2. 2
      src/features/Register/components/RegistrationStep/hooks/useForm.tsx
  3. 6
      src/features/Register/components/RegistrationStep/index.tsx
  4. 3
      src/requests/register.tsx

@ -9,4 +9,5 @@ export const formIds = {
password: 'password', password: 'password',
phone: 'phone', phone: 'phone',
postalCode: 'postalCode', postalCode: 'postalCode',
region: 'region',
} }

@ -69,6 +69,7 @@ export const useForm = () => {
const email = readFieldValue(formIds.email) const email = readFieldValue(formIds.email)
const password = readFieldValue(formIds.password) const password = readFieldValue(formIds.password)
const postalCode = Number(readFieldValue(formIds.postalCode)) const postalCode = Number(readFieldValue(formIds.postalCode))
const region = readFieldValue(formIds.region)
const address1 = readFieldValue(formIds.address1) const address1 = readFieldValue(formIds.address1)
const address2 = readFieldValue(formIds.address2) const address2 = readFieldValue(formIds.address2)
@ -84,6 +85,7 @@ export const useForm = () => {
password, password,
phone, phone,
postalCode, postalCode,
region,
}).then(goToLoginPage, showError) }).then(goToLoginPage, showError)
} }
} }

@ -99,6 +99,12 @@ export const RegistrationStep = () => {
label='Почтовый адрес' label='Почтовый адрес'
pattern={postalCodeRegex} pattern={postalCodeRegex}
/> />
<Input
required
id={formIds.region}
label='Регион'
pattern={commonFieldRegex}
/>
<Input <Input
required required
id={formIds.address1} id={formIds.address1}

@ -25,6 +25,7 @@ type Args = {
password: string, password: string,
phone: string, phone: string,
postalCode: number, postalCode: number,
region: string,
} }
export const register = async ({ export const register = async ({
@ -39,6 +40,7 @@ export const register = async ({
password, password,
phone, phone,
postalCode, postalCode,
region,
}: Args) => { }: Args) => {
const config = { const config = {
body: { body: {
@ -54,6 +56,7 @@ export const register = async ({
_p_password: password, _p_password: password,
_p_phone: phone, _p_phone: phone,
_p_postal_code: postalCode, _p_postal_code: postalCode,
_p_region: region,
}, },
proc, proc,
}, },

Loading…
Cancel
Save