Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/containers/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ function MainRoutes() {
}
/>
<Route path="/noredirect" element={<Noredirect />} />
<Route path="/redirect" element={<RedirectHandler />} />
</Route>
<Route path="*" element={<Error />} />
</Routes>
Expand All @@ -168,4 +169,4 @@ function MainRoutes() {
);
}

export default MainRoutes;
export default MainRoutes;
12 changes: 6 additions & 6 deletions src/pages/Organization/UserRegister.tsx
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
19 changes: 11 additions & 8 deletions src/pages/RedirectHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand All @@ -25,32 +27,33 @@ 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') {
return window.location.replace(path + queryParams);
}

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 (
<div className=" dark:bg-dark-frame-bg flex flex-col py-8 px-5 items-center justify-center grow h-full w-full">
<p>Redirecting...</p>
<p>
If you are not redirected in a few seconds, please click{' '}
<a className="underline" href={redirectUrl}>
here
</a>
</p>
</div>
);
}
Loading