import { Fragment } from 'react' import { Redirect } from 'react-router-dom' import { parse } from 'querystring' import isObject from 'lodash/isObject' import { useLocalStore } from 'hooks' import type { Settings } from 'features/AuthStore/helpers' import { getClientSettings } from 'features/AuthStore/helpers' import { T9n } from 'features/T9n' import { API_ROOT } from '../../config/routes' import { PAGES } from '../../config/pages' import { useOauth } from './hooks' import { Header, HeaderLogo, Content, DoneIcon, Title, Subtitle, Form, Input, SubmitButton, Text, StyledLink, Error, } from './styled' import { ErrorPopup } from '../../../../components/ErrorPopup' const url = `${API_ROOT}/oauth` const Oauth = () => { const { response_mode, response_type, scope, } = getClientSettings() const [urlParams] = useLocalStore>({ clearOnUnmount: true, defaultValue: {}, key: 'urlParams', validator: isObject, }) const idToken = parse(window.location.hash.replace('#', '')).id_token as string | undefined const { client_id, lang, nonce, redirect_uri, state, } = urlParams const { email, error, errorAuth, formRef, handleEmailBlur, handleEmailChange, handleEmailFocus, handleSubmit, isOpenErrorPopup, setIsOpenErrorPopup, showEmailField, } = useOauth() if (!idToken || !client_id || !redirect_uri) return if (showEmailField) { return (
You are one step away from creating inSports account! Complete the registration form by entering your email:
OK {error && ( )}
Also you can use any{' '} other method of authorization
setIsOpenErrorPopup(false)} isModalOpen={isOpenErrorPopup} error={errorAuth} />
) } return (
) } export default Oauth