fix(#2244): add client id in post request for change_password

keep-around/20e770c4c097d7291fab6e52719ce73c8a335f99
Andrei Dekterev 4 years ago
parent 6e9ad037df
commit 20e770c4c0
  1. 11
      src/features/AuthServiceApp/components/RecoveryPopup/hooks.tsx
  2. 9
      src/features/AuthServiceApp/requests/loginCheck.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)

@ -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,
}),

Loading…
Cancel
Save