Skip to content

Commit aee6621

Browse files
authored
Redirect when logged in for demo page (#1435)
Also fix wrong port options in process-compose config
1 parent c8cab54 commit aee6621

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

frontend/src/pages/demo.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
import { Alert, Button, Checkbox, Container, Paper, Title } from '@mantine/core';
22
import { useForm } from '@mantine/form';
33
import { IconAlertCircle } from '@tabler/icons-react';
4-
import React, { useState } from 'react';
4+
import React, { useEffect, useState } from 'react';
55
import { useTranslation } from 'react-i18next';
66
import { useNavigate } from 'react-router';
77

88
import { ClientOnly } from '../components/utils/react';
99
import { HCaptchaInput } from '../components/utils/util';
10+
import { tokenPresent } from '../services/local_storage';
1011
import { registerDemoUser } from '../services/user';
1112
import classes from './create_account.module.css';
1213

1314
export default function CreateDemoAccountPage() {
1415
const navigate = useNavigate();
1516
const { t } = useTranslation();
1617
const [captchaToken, setCaptchaToken] = useState<string | null>(null);
18+
useEffect(() => {
19+
if (tokenPresent()) {
20+
navigate('/');
21+
}
22+
}, []);
1723

1824
async function registerAndRedirect() {
1925
const response = await registerDemoUser(captchaToken);

process-compose-example.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ log_level: debug
44
processes:
55
frontend:
66
working_dir: "frontend"
7-
command: "pnpm run dev"
7+
command: "pnpm run dev --port 3000"
88
availability:
99
restart: "on_failure"
1010
readiness_probe:
@@ -36,7 +36,7 @@ processes:
3636

3737
docs:
3838
working_dir: "docs"
39-
command: "pnpm run dev -p 3001"
39+
command: "pnpm run dev --port 3001"
4040
availability:
4141
restart: "on_failure"
4242
readiness_probe:

0 commit comments

Comments
 (0)