-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add certificate files to production build and fix linting issues
- Loading branch information
etienne
committed
Feb 15, 2024
1 parent
9d4d4df
commit e87fa00
Showing
5 changed files
with
85 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,63 @@ | ||
"use client" | ||
import React, { useState } from 'react' | ||
import Link from 'next/link' | ||
import { useRouter } from 'next/router' | ||
import { Container } from './styles' | ||
import Layout from '../layout' | ||
|
||
"use client"; | ||
import React, { useState } from "react"; | ||
import Link from "next/link"; | ||
import { useRouter } from "next/router"; | ||
import { Container } from "./styles"; | ||
import Layout from "../layout"; | ||
|
||
export default function SignIn() { | ||
const [username, setUsername] = useState('') | ||
const [password, setPassword] = useState('') | ||
|
||
const [username, setUsername] = useState(""); | ||
const [password, setPassword] = useState(""); | ||
|
||
const router = useRouter() | ||
const { signIn } = useAuth() | ||
const router = useRouter(); | ||
const { signIn } = useAuth(); | ||
|
||
const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => { | ||
event.preventDefault() | ||
event.preventDefault(); | ||
|
||
try { | ||
await signIn({ username, password }) | ||
router.push('/chat') | ||
await signIn({ username, password }); | ||
router.push("/chat"); | ||
} catch (error) { | ||
console.error(error) | ||
alert('Erreur de connexion, veuillez vérifier vos identifiants.') | ||
console.error(error); | ||
alert("Erreur de connexion, veuillez vérifier vos identifiants."); | ||
} | ||
} | ||
}; | ||
|
||
return ( | ||
|
||
return ( | ||
<Container> | ||
<div > | ||
<form data-testid='login-form' onSubmit={handleSubmit}> | ||
<h2>Connectez-vous</h2> | ||
<p> Connectez-vous pour accéder à votre espace </p> | ||
|
||
<input | ||
type='text' | ||
placeholder="Entrez votre nom d'utilisateur " | ||
value={username} | ||
onChange={(event) => setUsername(event.target.value)} | ||
/> | ||
|
||
<input | ||
type='password' | ||
placeholder='Taper votre mot de passe' | ||
value={password} | ||
onChange={(event) => setPassword(event.target.value)} | ||
/> | ||
|
||
<button type='submit'>Connexion</button> | ||
</form> | ||
|
||
<Link legacyBehavior href='/signup'> | ||
<a> | ||
Vous n’avez pas de compte ? <span> Créer un compte</span> | ||
</a> | ||
</Link> | ||
</div> | ||
<div> | ||
<form data-testid="login-form" onSubmit={handleSubmit}> | ||
<h2>Connectez-vous</h2> | ||
<p> Connectez-vous pour accéder à votre espace </p> | ||
|
||
<input | ||
type="text" | ||
placeholder="Entrez votre nom d'utilisateur " | ||
value={username} | ||
onChange={(event) => setUsername(event.target.value)} | ||
/> | ||
|
||
<input | ||
type="password" | ||
placeholder="Taper votre mot de passe" | ||
value={password} | ||
onChange={(event) => setPassword(event.target.value)} | ||
/> | ||
|
||
<button type="submit">Connexion</button> | ||
</form> | ||
|
||
<Link legacyBehavior href="/signup"> | ||
<a> | ||
Vous n’avez pas de compte ? <span> Créer un compte</span> | ||
</a> | ||
</Link> | ||
</div> | ||
</Container> | ||
); | ||
} | ||
|
||
) | ||
} | ||
function useAuth(): { signIn: any } { | ||
throw new Error("Function not implemented."); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters