fix(#2199): add lang for post request

keep-around/11ba998252d14e10552e3bffcce91ab0afdc9329
Andrei Dekterev 4 years ago
parent 85d6f40fbf
commit 11ba998252
  1. 1
      src/features/AuthServiceApp/components/Login/hooks.tsx
  2. 4
      src/features/AuthServiceApp/components/RecoveryPopup/hooks.tsx
  3. 3
      src/features/AuthServiceApp/requests/loginCheck.tsx
  4. 4
      src/features/AuthServiceApp/styled.tsx

@ -9,7 +9,6 @@ import { addLanguageUrlParam } from 'helpers/languageUrlParam'
import { loginCheck } from 'features/AuthServiceApp/requests/auth' import { loginCheck } from 'features/AuthServiceApp/requests/auth'
import { getApiUrl } from 'features/AuthServiceApp/config/routes' import { getApiUrl } from 'features/AuthServiceApp/config/routes'
import { useLexicsStore } from 'features/LexicsStore' import { useLexicsStore } from 'features/LexicsStore'
import { useAuthFields } from 'features/AuthServiceApp/hooks/useAuthFields' import { useAuthFields } from 'features/AuthServiceApp/hooks/useAuthFields'

@ -2,8 +2,10 @@ import { ChangeEvent, useState } from 'react'
import { isValidEmail } from 'features/AuthServiceApp/helpers/isValidEmail' import { isValidEmail } from 'features/AuthServiceApp/helpers/isValidEmail'
import { loginCheckChangePass } from 'features/AuthServiceApp/requests/loginCheck' import { loginCheckChangePass } from 'features/AuthServiceApp/requests/loginCheck'
import { useLexicsStore } from 'features/LexicsStore'
export const useRecovery = (setIsModalOpen: (value: boolean) => void) => { export const useRecovery = (setIsModalOpen: (value: boolean) => void) => {
const { lang } = useLexicsStore()
const [isSendBtnDisabled, setIsSendBtnDisabled] = useState(true) const [isSendBtnDisabled, setIsSendBtnDisabled] = useState(true)
const [error, setError] = useState('') const [error, setError] = useState('')
const [email, setEmail] = useState('') const [email, setEmail] = useState('')
@ -39,7 +41,7 @@ export const useRecovery = (setIsModalOpen: (value: boolean) => void) => {
const handleSubmit = async () => { const handleSubmit = async () => {
try { try {
setIsFetching(true) setIsFetching(true)
await loginCheckChangePass(email) await loginCheckChangePass(email, lang)
setIsFetching(false) setIsFetching(false)
setIsSendMessage(true) setIsSendMessage(true)
} catch (err) { } catch (err) {

@ -17,11 +17,12 @@ type SuccessResponse = {
ok: true, ok: true,
} }
export const loginCheckChangePass = async (email: string) => { export const loginCheckChangePass = async (email: string, lang: string) => {
const url = getApiUrl('/change_password') const url = getApiUrl('/change_password')
const init: RequestInit = { const init: RequestInit = {
body: new URLSearchParams({ body: new URLSearchParams({
email, email,
lang,
}), }),
method: 'POST', method: 'POST',
} }

@ -45,7 +45,7 @@ export const Form = styled.form`
? css` ? css`
width: 100%; width: 100%;
margin-top: 78px; margin-top: 78px;
@media screen and (orientation: landscape) { @media screen and (orientation: landscape){
margin-bottom: 0; margin-bottom: 0;
margin-top: 10px; margin-top: 10px;
padding: 0; padding: 0;
@ -61,7 +61,7 @@ export const BlockTitle = styled(T9n)`
font-size: 24px; font-size: 24px;
height: 24px; height: 24px;
color: ${({ theme: { colors } }) => colors.text100}; color: ${({ theme: { colors } }) => colors.text100};
margin-bottom: 30px;, margin-bottom: 30px;
${isMobileDevice ${isMobileDevice
? css` ? css`
font-size: 20px; font-size: 20px;

Loading…
Cancel
Save