Skip to content

Commit

Permalink
[FIX] Invitation links don't redirect to the registration form (#25082)
Browse files Browse the repository at this point in the history
  • Loading branch information
yash-rajpal committed Apr 7, 2022
1 parent 71d0ed8 commit 8fd7638
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion client/views/invite/InvitePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { useSetting } from '../../contexts/SettingsContext';
import { useToastMessageDispatch } from '../../contexts/ToastMessagesContext';
import { useTranslation } from '../../contexts/TranslationContext';
import { useUserId } from '../../contexts/UserContext';
import LoginPage from '../root/MainLayout/LoginPage';
import PageLoading from '../root/PageLoading';

const InvitePage = (): ReactElement => {
Expand All @@ -23,7 +24,7 @@ const InvitePage = (): ReactElement => {
const groupRoute = useRoute('/group/:name/:tab?/:context?');
const channelRoute = useRoute('/channel/:name/:tab?/:context?');

const { isLoading } = useQuery(
const { isLoading, data } = useQuery(
['invite', token],
async () => {
if (!token) {
Expand Down Expand Up @@ -85,6 +86,10 @@ const InvitePage = (): ReactElement => {
},
);

if (data) {
return <LoginPage />;
}

if (isLoading) {
return <PageLoading />;
}
Expand Down

0 comments on commit 8fd7638

Please sign in to comment.