fix(#2227): fix post params in auth

keep-around/78728aaea3c73604b730226a5c18add5a7bcecd6
Andrei Dekterev 4 years ago
parent 12dde922e1
commit 7631931f01
  1. 9
      src/features/AuthServiceApp/components/Login/hooks.tsx
  2. 5
      src/features/AuthServiceApp/components/Login/index.tsx
  3. 4
      src/features/AuthServiceApp/requests/authСheck.tsx

@ -15,6 +15,7 @@ import { useLocation } from 'react-router'
const url = getApiUrl('/authorize')
export const useLoginForm = () => {
const location = useLocation()
const { lang } = useLexicsStore()
const [authError, setAuthError] = useState('')
const [isFetching, setIsFetching] = useState(false)
@ -43,10 +44,7 @@ export const useLoginForm = () => {
setIsModalOpen(true)
}
// const submitForm = () => formRef.current?.submit()
const location = useLocation()
const redirect_url = new URLSearchParams(location.search).get('redirect_uri')
const redirect_url = new URLSearchParams(location.search).get('redirect_uri') || ''
const handleError = (error: string) => {
setAuthError(error)
@ -61,12 +59,13 @@ export const useLoginForm = () => {
email,
lang,
password,
redirect_url,
)
await (authorize(
email,
lang,
password,
redirect_url || '',
redirect_url,
))
} catch (err) {
handleError(String(err))

@ -27,7 +27,6 @@ const Login = () => {
authError,
email,
formError,
formRef,
handleModalOpen,
handleSubmit,
isFetching,
@ -39,16 +38,12 @@ const Login = () => {
onPasswordChange,
password,
setIsModalOpen,
url,
} = useLoginForm()
return (
<CenterBlock>
<Logo />
<Form
method='POST'
ref={formRef}
action={url}
onSubmit={handleSubmit}
>
<BlockTitle t='step_title_login' />

@ -23,10 +23,10 @@ export const loginCheck = async (
email: string,
lang: string,
password: string,
redirect_url: string,
) => {
const {
client_id,
redirect_uri,
response_mode,
response_type,
scope,
@ -35,7 +35,7 @@ export const loginCheck = async (
const paramsUrl = {
client_id,
lang,
redirect_uri,
redirect_uri: redirect_url,
response_mode,
response_type,
scope,

Loading…
Cancel
Save