Compare commits

...

3 Commits

Author SHA1 Message Date
2c3480f980 Fix use of localstorage in server side
Some checks failed
Check usage of free licenses / build-static-assets (pull_request) Successful in 48s
Playwright Tests / test (pull_request) Failing after 54s
Add copyright notice / copyright_notice (pull_request) Successful in 1m4s
Build Nginx-based docker image / build-static-assets (push) Failing after 2m34s
2025-06-08 12:33:44 +02:00
22a2cba3fe Fix the path used for checking upstatus 2025-06-08 12:19:01 +02:00
01717b392c Revert "Try localhost"
This reverts commit e0da10c0006d8f984771dbdc38508b69f902835e.
2025-06-08 11:49:44 +02:00
6 changed files with 20 additions and 12 deletions

View File

@ -25,8 +25,8 @@ jobs:
- name: Install Playwright Browsers
run: pnpm exec playwright install --with-deps
- name: Run the service that will be tested
run: HOSTNAME=localhost node .next/standalone/server.js &
run: HOSTNAME=127.0.0.1 node .next/standalone/server.js &
- name: Wait for the service to be ready
run: npx wait-on http://localhost:3000/default/dashboard/guests --timeout 30000
run: npx wait-on http://127.0.0.1:3000/default/ --timeout 30000
- name: Run Playwright tests
run: DEBUG=pw:api pnpm exec playwright test

View File

@ -15,12 +15,15 @@ import SkeletonTable from '@/app/ui/guests/skeleton-row';
import GuestsTable from '@/app/ui/guests/table';
import { TabPanel, TabView } from 'primereact/tabview';
import { Toast } from 'primereact/toast';
import { Suspense, useRef, useState } from 'react';
import { Suspense, useEffect, useRef, useState } from 'react';
import InvitationsBoard from '@/app/ui/invitations/board';
import { Invitation, InvitationSerializer } from '@/app/lib/invitation';
export default function Page() {
const [slug, setSlug] = useState<string | null>(null);
useEffect(() => { setSlug(getSlug()) }, []);
const toast = useRef<Toast>(null);
function refreshGuests() {
@ -45,7 +48,7 @@ export default function Page() {
}
function resetAffinities() {
fetch(`/api/${getSlug()}/groups/affinities/reset`, {
fetch(`/api/${slug}/groups/affinities/reset`, {
method: 'POST',
headers: {
'Accept': 'application/json',

View File

@ -16,11 +16,11 @@ export default async function Page() {
if (getCsrfToken() == 'unknown') {
retrieveCSRFToken();
}
}, []);
if (typeof window !== 'undefined') {
localStorage.setItem('slug', await params.slug);
}
if (typeof window !== 'undefined') {
localStorage.setItem('slug', params.slug);
}
}, []);
return (
<main className="flex min-h-screen flex-col p-6">

View File

@ -14,6 +14,9 @@ import { getSlug } from '@/app/lib/utils';
export default function LoginForm() {
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [slug, setSlug] = useState<string | null>(null);
useEffect(() => {setSlug(getSlug())}, []);
const router = useRouter();
@ -41,7 +44,7 @@ export default function LoginForm() {
password: password,
onLogin: (user) => {
setCurrentUser(user);
router.push(`${getSlug()}/dashboard`)
router.push(`${slug}/dashboard`)
}
})}>
Sign in

View File

@ -17,7 +17,9 @@ export default function RegistrationForm() {
const [email, setEmail] = useState<string>("");
const [password, setPassword] = useState<string>("");
const [passwordConfirmation, setPasswordConfirmation] = useState<string>("");
const [slug, setSlug] = useState<string>(getSlug());
const [slug, setSlug] = useState<string | null>(null);
useEffect(() => { setSlug(getSlug()) }, []);
const [captchaId, setCaptchaId] = useState<string>("");
const [captchaUrl, setCaptchaUrl] = useState<string>("");

View File

@ -25,7 +25,7 @@ export default defineConfig({
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: 'http://localhost:3000',
baseURL: 'http://127.0.0.1:3000',
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
@ -67,7 +67,7 @@ export default defineConfig({
/* Run your local dev server before starting the tests */
// webServer: {
// command: 'npm run start',
// url: 'http://localhost:3000',
// url: 'http://127.0.0.1:3000',
// reuseExistingServer: !process.env.CI,
// },
});