From 20e770c4c097d7291fab6e52719ce73c8a335f99 Mon Sep 17 00:00:00 2001 From: Andrei Dekterev Date: Fri, 11 Mar 2022 19:13:01 +0700 Subject: [PATCH] fix(#2244): add client id in post request for change_password --- .../AuthServiceApp/components/RecoveryPopup/hooks.tsx | 11 ++++++++--- src/features/AuthServiceApp/requests/loginCheck.tsx | 9 ++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/features/AuthServiceApp/components/RecoveryPopup/hooks.tsx b/src/features/AuthServiceApp/components/RecoveryPopup/hooks.tsx index 2cb85698..baf7e127 100644 --- a/src/features/AuthServiceApp/components/RecoveryPopup/hooks.tsx +++ b/src/features/AuthServiceApp/components/RecoveryPopup/hooks.tsx @@ -6,10 +6,11 @@ import { import { isValidEmail } from 'features/AuthServiceApp/helpers/isValidEmail' import { loginCheckChangePass } from 'features/AuthServiceApp/requests/loginCheck' -import { useLexicsStore } from 'features/LexicsStore' + +import { useParamsUrl } from '../../hooks/useParamsUrl' export const useRecovery = (setIsModalOpen: (value: boolean) => void) => { - const { lang } = useLexicsStore() + const { client_id, lang } = useParamsUrl() const [isSendBtnDisabled, setIsSendBtnDisabled] = useState(true) const [error, setError] = useState('') const [email, setEmail] = useState('') @@ -46,7 +47,11 @@ export const useRecovery = (setIsModalOpen: (value: boolean) => void) => { const handleSubmit = () => { setIsFetching(true) - loginCheckChangePass(email, lang) + loginCheckChangePass( + client_id, + email, + lang, + ) .then(() => { setIsFetching(false) setIsSendMessage(true) diff --git a/src/features/AuthServiceApp/requests/loginCheck.tsx b/src/features/AuthServiceApp/requests/loginCheck.tsx index 68f74f79..e1c34e18 100644 --- a/src/features/AuthServiceApp/requests/loginCheck.tsx +++ b/src/features/AuthServiceApp/requests/loginCheck.tsx @@ -1,3 +1,5 @@ +import { ClientIds } from 'config/clients/types' + import { getApiUrl } from '../config/routes' const errorLexics = { @@ -17,10 +19,15 @@ type SuccessResponse = { ok: true, } -export const loginCheckChangePass = async (email: string, lang: string) => { +export const loginCheckChangePass = async ( + client_id: ClientIds, + email: string, + lang: string, +) => { const url = getApiUrl('/change_password') const init: RequestInit = { body: new URLSearchParams({ + client_id, email, lang, }),