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 { getApiUrl } from 'features/AuthServiceApp/config/routes'
import { useLexicsStore } from 'features/LexicsStore'
import { useAuthFields } from 'features/AuthServiceApp/hooks/useAuthFields'

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

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

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

Loading…
Cancel
Save