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