From 11ba998252d14e10552e3bffcce91ab0afdc9329 Mon Sep 17 00:00:00 2001 From: Andrei Dekterev Date: Tue, 8 Feb 2022 14:31:45 +0700 Subject: [PATCH] fix(#2199): add lang for post request --- src/features/AuthServiceApp/components/Login/hooks.tsx | 1 - .../AuthServiceApp/components/RecoveryPopup/hooks.tsx | 4 +++- src/features/AuthServiceApp/requests/loginCheck.tsx | 3 ++- src/features/AuthServiceApp/styled.tsx | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/features/AuthServiceApp/components/Login/hooks.tsx b/src/features/AuthServiceApp/components/Login/hooks.tsx index d624dec1..e100db81 100644 --- a/src/features/AuthServiceApp/components/Login/hooks.tsx +++ b/src/features/AuthServiceApp/components/Login/hooks.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' diff --git a/src/features/AuthServiceApp/components/RecoveryPopup/hooks.tsx b/src/features/AuthServiceApp/components/RecoveryPopup/hooks.tsx index f2faad74..c58efbc9 100644 --- a/src/features/AuthServiceApp/components/RecoveryPopup/hooks.tsx +++ b/src/features/AuthServiceApp/components/RecoveryPopup/hooks.tsx @@ -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) { diff --git a/src/features/AuthServiceApp/requests/loginCheck.tsx b/src/features/AuthServiceApp/requests/loginCheck.tsx index 1cdbd889..68f74f79 100644 --- a/src/features/AuthServiceApp/requests/loginCheck.tsx +++ b/src/features/AuthServiceApp/requests/loginCheck.tsx @@ -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', } diff --git a/src/features/AuthServiceApp/styled.tsx b/src/features/AuthServiceApp/styled.tsx index 4f48517d..9b32ea81 100644 --- a/src/features/AuthServiceApp/styled.tsx +++ b/src/features/AuthServiceApp/styled.tsx @@ -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;