diff --git a/src/containers/Routes.tsx b/src/containers/Routes.tsx index d025f6c2e..3b083aada 100644 --- a/src/containers/Routes.tsx +++ b/src/containers/Routes.tsx @@ -160,6 +160,7 @@ function MainRoutes() { } /> } /> + } /> } /> @@ -168,4 +169,4 @@ function MainRoutes() { ); } -export default MainRoutes; \ No newline at end of file +export default MainRoutes; diff --git a/src/pages/Organization/UserRegister.tsx b/src/pages/Organization/UserRegister.tsx index 350a49597..5080f17d2 100644 --- a/src/pages/Organization/UserRegister.tsx +++ b/src/pages/Organization/UserRegister.tsx @@ -1,21 +1,21 @@ /* eslint-disable */ -import { useApolloClient, useLazyQuery, useMutation } from '@apollo/client'; -import React, { useContext, useState, useEffect } from 'react'; +import { useLazyQuery, useMutation } from '@apollo/client'; +import React, { useContext, useEffect, useState } from 'react'; import { useForm } from 'react-hook-form'; +import jwt_decode from 'jwt-decode'; import { useTranslation } from 'react-i18next'; -import { FaGoogle, FaRegEnvelope, FaRegEye } from 'react-icons/fa'; +import { FaRegEnvelope, FaRegEye } from 'react-icons/fa'; import { FiEyeOff } from 'react-icons/fi'; import { MdLockOutline } from 'react-icons/md'; import { Link, useLocation, useNavigate } from 'react-router-dom'; import { toast } from 'react-toastify'; import ButtonLoading from '../../components/ButtonLoading'; import Button from '../../components/Buttons'; +import ControlledSelect from '../../components/ControlledSelect'; import { UserContext } from '../../hook/useAuth'; import useDocumentTitle from '../../hook/useDocumentTitle'; -import { SIGN_UP_MUTATION, GET_SIGNUP_ORGANIZATION } from './Mutations'; -import ControlledSelect from '../../components/ControlledSelect'; -import jwt_decode from 'jwt-decode'; +import { GET_SIGNUP_ORGANIZATION, SIGN_UP_MUTATION } from './Mutations'; const Signup = () => { const token: any = window.location.href.substring( diff --git a/src/pages/RedirectHandler.tsx b/src/pages/RedirectHandler.tsx index 14548c780..c46be3727 100644 --- a/src/pages/RedirectHandler.tsx +++ b/src/pages/RedirectHandler.tsx @@ -3,6 +3,8 @@ import React, { useEffect } from 'react'; const APP_ID = 'com.atlp.pulseapp'; export default function RedirectHandler() { + const [redirectUrl, setRedirectUrl] = React.useState(''); + const buildQueryString = (params: URLSearchParams) => { let queryParams = '?'; const ignoredKeys = ['path', 'dest', 'fallback']; @@ -25,6 +27,7 @@ export default function RedirectHandler() { const path = params.get('path'); const destnation = params.get('dest'); const fallback = params.get('fallback'); + setRedirectUrl(fallback ?? '/'); if (path != null) { if (destnation === 'web') { @@ -32,25 +35,25 @@ export default function RedirectHandler() { } if (destnation === 'app') { - setTimeout( - () => window.location.replace(`${APP_ID}://${path}${queryParams}`), - 500, - ); - window.location.replace(fallback ? fallback + queryParams : '/'); + window.location.replace(`${APP_ID}://${path}${queryParams}`); } - - window.location.replace(fallback ? fallback + queryParams : '/'); } else { // eslint-disable-next-line no-console console.error('Invalid redirect data'); } return () => {}; - }, []); + }, [redirectUrl]); return (

Redirecting...

+

+ If you are not redirected in a few seconds, please click{' '} + + here + +

); }