fix: text

This commit is contained in:
Elie Baier 2023-12-05 22:05:03 +01:00
parent ff44beb61b
commit a1fb215aa4
1 changed files with 10 additions and 4 deletions

View File

@ -1,12 +1,18 @@
'use client'; 'use client';
import { useState } from 'react'; import { useState, useEffect } from 'react';
import { useRouter } from 'next/navigation'; import { useRouter } from 'next/navigation';
export default function Home() { export default function Home() {
const [password, setPassword] = useState(''); const [password, setPassword] = useState('');
const router = useRouter(); const router = useRouter();
useEffect(() => {
if (localStorage.getItem('@password')) {
router.push('/play');
}
}, [router]);
function handleSubmit(event: React.FormEvent<HTMLFormElement>) { function handleSubmit(event: React.FormEvent<HTMLFormElement>) {
event.preventDefault(); event.preventDefault();
@ -15,9 +21,9 @@ export default function Home() {
} }
return ( return (
<div className={""}> <div className={''}>
<h1 className={"border-l-blue-600"}>Calendrier-avent</h1> <h1 className={'border-l-blue-600'}>Calendrier-avent</h1>
<p>Please enter the password :</p> <p>Merci d'entrer votre clé :</p>
<form onSubmit={handleSubmit}> <form onSubmit={handleSubmit}>
<input type="password" id="password" name="password" value={password} onChange={(e) => setPassword(e.target.value)}></input> <input type="password" id="password" name="password" value={password} onChange={(e) => setPassword(e.target.value)}></input>
<input type="submit" value="Submit"></input> <input type="submit" value="Submit"></input>