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
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
This commit is contained in:
parent
22a2cba3fe
commit
2c3480f980
@ -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',
|
||||
|
@ -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">
|
||||
|
@ -15,6 +15,9 @@ 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();
|
||||
|
||||
const [currentUser, setCurrentUser] = useState<User | null>(null);
|
||||
@ -41,7 +44,7 @@ export default function LoginForm() {
|
||||
password: password,
|
||||
onLogin: (user) => {
|
||||
setCurrentUser(user);
|
||||
router.push(`${getSlug()}/dashboard`)
|
||||
router.push(`${slug}/dashboard`)
|
||||
}
|
||||
})}>
|
||||
Sign in
|
||||
|
@ -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>("");
|
||||
|
Loading…
x
Reference in New Issue
Block a user