Compare commits

..

No commits in common. "98d3afcd8e766a6fd95327da2abca819b06da47e" and "f68587419d13847c76772384de8e66934f7533ab" have entirely different histories.

2 changed files with 6 additions and 27 deletions

View File

@ -5,22 +5,10 @@
import LoginForm from '@/app/ui/components/login-form'; import LoginForm from '@/app/ui/components/login-form';
import RegistrationForm from '@/app/ui/components/registration-form'; import RegistrationForm from '@/app/ui/components/registration-form';
import { useParams } from 'next/navigation' import { useParams } from 'next/navigation'
import { useEffect } from 'react';
import { retrieveCSRFToken } from '../api/authentication';
import { getCsrfToken } from '../lib/utils';
export default async function Page() { export default async function Page() {
const params = useParams<{ slug: string }>() const params = useParams<{ slug: string }>()
useEffect(() => {
if (getCsrfToken() == 'unknown') {
retrieveCSRFToken();
}
}, []);
if (typeof window !== 'undefined') {
localStorage.setItem('slug', await params.slug); localStorage.setItem('slug', await params.slug);
}
return ( return (
<main className="flex min-h-screen flex-col p-6"> <main className="flex min-h-screen flex-col p-6">

View File

@ -43,15 +43,6 @@ function flattenErrors(errors: StructuredErrors): string[] {
}); });
} }
// At this moment we're making an initial request to get a valid CSRF token
export function retrieveCSRFToken() {
return fetch(`/api/token`, {
headers: {
'Accept': 'application/json',
}
}).then((response) => { return null });
}
export function register({slug, email, password, passwordConfirmation, captcha, onRegister, onError}: { export function register({slug, email, password, passwordConfirmation, captcha, onRegister, onError}: {
slug: string, slug: string,
email: string, email: string,