mirror of
https://github.com/LucasVbr/meeting-app.git
synced 2026-05-13 17:21:53 +00:00
Edit schema
Took 2 hours 51 minutes
This commit is contained in:
+28
-14
@@ -1,3 +1,4 @@
|
|||||||
|
// Connexion
|
||||||
generator client {
|
generator client {
|
||||||
provider = "prisma-client-js"
|
provider = "prisma-client-js"
|
||||||
}
|
}
|
||||||
@@ -7,24 +8,37 @@ datasource db {
|
|||||||
url = env("DATABASE_URL")
|
url = env("DATABASE_URL")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Models
|
||||||
model User {
|
model User {
|
||||||
id String @id @default(auto()) @map("_id") @db.ObjectId
|
id String @id @default(auto()) @map("_id") @db.ObjectId
|
||||||
email String @unique
|
email String @unique
|
||||||
password String?
|
password String?
|
||||||
name String
|
firstName String
|
||||||
surname String
|
lastName String
|
||||||
admin Boolean @default(false)
|
role Role @default(USER)
|
||||||
|
|
||||||
messageSent Chat[]
|
Chat Chat? @relation(fields: [chatId], references: [id])
|
||||||
messageReceived Chat[] @relation("chatReceived")
|
chatId String? @db.ObjectId
|
||||||
|
Message Message[]
|
||||||
}
|
}
|
||||||
|
|
||||||
model Chat {
|
model Chat {
|
||||||
id String @id @default(auto()) @map("_id") @db.ObjectId
|
id String @id @default(auto()) @map("_id") @db.ObjectId
|
||||||
message String
|
messages Message[]
|
||||||
sender User? @relation(fields: [senderId], references: [id])
|
users User[]
|
||||||
senderId String @db.ObjectId
|
|
||||||
receiver User? @relation(name:"chatReceived", fields: [receiverId], references: [id])
|
|
||||||
receiverId String @db.ObjectId
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
model Message {
|
||||||
|
id String @id @default(auto()) @map("_id") @db.ObjectId
|
||||||
|
message String
|
||||||
|
user User @relation(fields: [userId], references: [id])
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
Chat Chat @relation(fields: [chatId], references: [id])
|
||||||
|
userId String @db.ObjectId
|
||||||
|
chatId String @db.ObjectId
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Role {
|
||||||
|
USER
|
||||||
|
ADMIN
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
type CreateUserQuery = {
|
||||||
|
email: string
|
||||||
|
password: string
|
||||||
|
firstName: string
|
||||||
|
lastName: string
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReadUserQuery = {
|
||||||
|
id?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
type DeleteUserQuery = {
|
||||||
|
id: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export type {CreateUserQuery, ReadUserQuery, DeleteUserQuery};
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
import {NextApiRequest, NextApiResponse} from 'next';
|
import {NextApiRequest, NextApiResponse} from 'next';
|
||||||
import { PrismaClient } from '@prisma/client'
|
import { PrismaClient } from '@prisma/client'
|
||||||
|
import type {CreateUserQuery} from '@/models/api/user';
|
||||||
|
|
||||||
|
const prisma = new PrismaClient();
|
||||||
|
|
||||||
export const prisma = new PrismaClient();
|
|
||||||
export default async function createUser(req: NextApiRequest, res: NextApiResponse) {
|
export default async function createUser(req: NextApiRequest, res: NextApiResponse) {
|
||||||
|
const {email, password, firstName, lastName} = req.body as CreateUserQuery;
|
||||||
|
|
||||||
|
if (!email || !password || !firstName || !lastName)
|
||||||
const {email, password, name, surname} = req.body
|
return res.status(400).send({message: req.body});
|
||||||
|
|
||||||
|
|
||||||
if (!email || !password) return res.status(400).send({message: req.body})
|
|
||||||
|
|
||||||
const newUser = await prisma.user.create({
|
const newUser = await prisma.user.create({
|
||||||
data: {email, password, name, surname},
|
data: {email, password, firstName, lastName},
|
||||||
});
|
});
|
||||||
|
|
||||||
return res.status(201).send({message: "createUser", newUser});
|
return res.status(201).send({message: "createUser", newUser});
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
import {NextApiRequest, NextApiResponse} from 'next';
|
import {NextApiRequest, NextApiResponse} from 'next';
|
||||||
import { PrismaClient } from '@prisma/client'
|
import { PrismaClient } from '@prisma/client'
|
||||||
|
import type {DeleteUserQuery} from '@/models/api/user';
|
||||||
|
|
||||||
export const prisma = new PrismaClient();
|
const prisma = new PrismaClient();
|
||||||
|
|
||||||
export default async function deleteUser(req: NextApiRequest, res: NextApiResponse) {
|
export default async function deleteUser(req: NextApiRequest, res: NextApiResponse) {
|
||||||
const {id} = req.query
|
const {id} = req.query as DeleteUserQuery
|
||||||
|
|
||||||
if (!id) return res.status(400).send({message: "error"});
|
if (!id) return res.status(400).send({message: "error"});
|
||||||
|
|
||||||
const deletedUser = await prisma.user.delete({
|
const deletedUser = await prisma.user.delete({
|
||||||
where: { id }
|
where: { id }
|
||||||
});
|
});
|
||||||
|
|
||||||
return res.status(200).send({message: "deleteUser", deletedUser});
|
return res.status(200).send({message: "deleteUser", deletedUser});
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,8 @@
|
|||||||
import type {NextApiRequest, NextApiResponse} from 'next';
|
import type {NextApiRequest, NextApiResponse} from 'next';
|
||||||
import createUser from '@/pages/api/user/createUser';
|
|
||||||
import readUser from '@/pages/api/user/readUser';
|
|
||||||
import updateUser from '@/pages/api/user/updateUser';
|
import updateUser from '@/pages/api/user/updateUser';
|
||||||
import deleteUser from '@/pages/api/user/deleteUser';
|
|
||||||
import CRUD from '@/utils/CRUD';
|
import CRUD from '@/utils/CRUD';
|
||||||
|
import {CreateUserQuery, DeleteUserQuery} from '@/models/api/user';
|
||||||
|
import {PrismaClient} from '@prisma/client';
|
||||||
|
|
||||||
export default function handler(
|
export default function handler(
|
||||||
req: NextApiRequest,
|
req: NextApiRequest,
|
||||||
@@ -16,9 +14,40 @@ export default function handler(
|
|||||||
if (method === CRUD.READ) return readUser(req, res);
|
if (method === CRUD.READ) return readUser(req, res);
|
||||||
if (method === CRUD.UPDATE) return updateUser(req, res);
|
if (method === CRUD.UPDATE) return updateUser(req, res);
|
||||||
if (method === CRUD.DELETE) return deleteUser(req, res);
|
if (method === CRUD.DELETE) return deleteUser(req, res);
|
||||||
return help(req, res);
|
return help(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
function help(req: NextApiRequest, res: NextApiResponse) {
|
function help(res: NextApiResponse) {
|
||||||
res.status(400).send({message: 'error'}); // TODO add help message
|
res.status(400).send({message: 'error'}); // TODO add help message
|
||||||
|
}
|
||||||
|
|
||||||
|
const prisma = new PrismaClient();
|
||||||
|
|
||||||
|
async function createUser(req: NextApiRequest, res: NextApiResponse) {
|
||||||
|
const {email, password, firstName, lastName} = req.body as CreateUserQuery;
|
||||||
|
|
||||||
|
if (!email || !password || !firstName || !lastName)
|
||||||
|
return res.status(400).send({message: req.body});
|
||||||
|
|
||||||
|
const newUser = await prisma.user.create({
|
||||||
|
data: {email, password, firstName, lastName},
|
||||||
|
});
|
||||||
|
|
||||||
|
return res.status(201).send({message: 'createUser', newUser});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function deleteUser(req: NextApiRequest, res: NextApiResponse) {
|
||||||
|
const {id} = req.query as DeleteUserQuery;
|
||||||
|
if (!id) return res.status(400).send({message: 'error'});
|
||||||
|
|
||||||
|
const deletedUser = await prisma.user.delete({
|
||||||
|
where: {id},
|
||||||
|
});
|
||||||
|
return res.status(200).send({message: 'deleteUser', deletedUser});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function readUser(req: NextApiRequest, res: NextApiResponse) {
|
||||||
|
const users = await prisma.user.findMany();
|
||||||
|
|
||||||
|
return res.status(200).send({message: 'readUser', users});
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import {NextApiRequest, NextApiResponse} from 'next';
|
import {NextApiRequest, NextApiResponse} from 'next';
|
||||||
import { PrismaClient } from '@prisma/client'
|
import { PrismaClient } from '@prisma/client'
|
||||||
|
|
||||||
export const prisma = new PrismaClient();
|
const prisma = new PrismaClient();
|
||||||
|
|
||||||
export default async function readUser(req: NextApiRequest, res: NextApiResponse) {
|
export default async function readUser(req: NextApiRequest, res: NextApiResponse) {
|
||||||
const users = await prisma.user.findMany()
|
const users = await prisma.user.findMany()
|
||||||
|
|||||||
@@ -1,98 +0,0 @@
|
|||||||
import {
|
|
||||||
Box,
|
|
||||||
Button,
|
|
||||||
Flex,
|
|
||||||
FormControl,
|
|
||||||
FormLabel,
|
|
||||||
Heading,
|
|
||||||
Image,
|
|
||||||
Input,
|
|
||||||
Spacer,
|
|
||||||
} from "@chakra-ui/react";
|
|
||||||
import { useRouter } from "next/router";
|
|
||||||
import { useForm } from "react-hook-form";
|
|
||||||
|
|
||||||
export default function Login() {
|
|
||||||
const {
|
|
||||||
handleSubmit,
|
|
||||||
register,
|
|
||||||
formState: { errors, isSubmitting },
|
|
||||||
} = useForm();
|
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
|
|
||||||
const onLogin = async (values) => {
|
|
||||||
alert(JSON.stringify(values, null, 2));
|
|
||||||
// faut voir ce qu'on fait quand on se connecte
|
|
||||||
};
|
|
||||||
|
|
||||||
const redirect_home = () => {
|
|
||||||
router.push("/");
|
|
||||||
};
|
|
||||||
|
|
||||||
const RightSide = () => (
|
|
||||||
<Flex
|
|
||||||
justify={"center"}
|
|
||||||
direction={"column"}
|
|
||||||
flexBasis={"100%"}
|
|
||||||
align={"center"}
|
|
||||||
>
|
|
||||||
<Heading mb={"2.5rem"}>Connexion</Heading>
|
|
||||||
<Box w={"25vw"}>
|
|
||||||
<form onSubmit={handleSubmit(onLogin)}>
|
|
||||||
<FormControl isInvalid={errors.name}>
|
|
||||||
<Box mb={"1rem"}>
|
|
||||||
<FormLabel>Adresse email</FormLabel>
|
|
||||||
<Input
|
|
||||||
id="email"
|
|
||||||
type="email"
|
|
||||||
placeholder="Adresse@email.com"
|
|
||||||
{...register("email", {
|
|
||||||
required: "This is required",
|
|
||||||
})}
|
|
||||||
/>
|
|
||||||
</Box>
|
|
||||||
<Box mb={"1rem"}>
|
|
||||||
<FormLabel>Mot de passe</FormLabel>
|
|
||||||
<Input
|
|
||||||
id="pwd"
|
|
||||||
type="password"
|
|
||||||
placeholder="Mot de passe"
|
|
||||||
{...register("pwd", {
|
|
||||||
required: "This is required",
|
|
||||||
})}
|
|
||||||
/>
|
|
||||||
</Box>
|
|
||||||
<Flex mt={"1rem"} w={"100%"}>
|
|
||||||
<Button onClick={redirect_home}>Retour</Button>
|
|
||||||
<Spacer />
|
|
||||||
<Button colorScheme="purple" type="submit">
|
|
||||||
Connexion
|
|
||||||
</Button>
|
|
||||||
</Flex>
|
|
||||||
</FormControl>
|
|
||||||
</form>
|
|
||||||
</Box>
|
|
||||||
</Flex>
|
|
||||||
);
|
|
||||||
|
|
||||||
const LeftSide = () => (
|
|
||||||
<Box flexBasis={"100%"}>
|
|
||||||
<Image
|
|
||||||
h={"100vh"}
|
|
||||||
w={"100%"}
|
|
||||||
src={"/couple_horizon.png"}
|
|
||||||
alt="couple looking at horizon"
|
|
||||||
/>
|
|
||||||
</Box>
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Box>
|
|
||||||
<Flex gap={10}>
|
|
||||||
<LeftSide />
|
|
||||||
<RightSide />
|
|
||||||
</Flex>
|
|
||||||
</Box>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
import {
|
||||||
|
Box,
|
||||||
|
Button,
|
||||||
|
Flex,
|
||||||
|
FormControl,
|
||||||
|
FormLabel,
|
||||||
|
Heading,
|
||||||
|
Image,
|
||||||
|
Input,
|
||||||
|
Spacer,
|
||||||
|
} from '@chakra-ui/react';
|
||||||
|
import {useRouter} from 'next/router';
|
||||||
|
import {useForm} from 'react-hook-form';
|
||||||
|
|
||||||
|
type FormValues = {
|
||||||
|
email: string
|
||||||
|
password: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function Login() {
|
||||||
|
const {
|
||||||
|
handleSubmit,
|
||||||
|
register,
|
||||||
|
formState: {errors, isSubmitting},
|
||||||
|
} = useForm();
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
const onLogin = async (values: FormValues) => {
|
||||||
|
alert(JSON.stringify(values, null, 2));
|
||||||
|
// faut voir ce qu'on fait quand on se connecte
|
||||||
|
};
|
||||||
|
|
||||||
|
const goHome = () => {
|
||||||
|
router.push('/');
|
||||||
|
};
|
||||||
|
|
||||||
|
const RightSide = () => (
|
||||||
|
<Flex
|
||||||
|
justify={'center'}
|
||||||
|
direction={'column'}
|
||||||
|
flexBasis={'100%'}
|
||||||
|
align={'center'}
|
||||||
|
>
|
||||||
|
<Heading mb={'2.5rem'}>Connexion</Heading>
|
||||||
|
|
||||||
|
<Box w={'25vw'}>
|
||||||
|
<form onSubmit={handleSubmit(onLogin)}>
|
||||||
|
<FormControl isInvalid={errors.name}>
|
||||||
|
<Box mb={'1rem'}>
|
||||||
|
<FormLabel>Adresse email</FormLabel>
|
||||||
|
<Input
|
||||||
|
id="email"
|
||||||
|
type="email"
|
||||||
|
placeholder="Adresse@email.com"
|
||||||
|
{...register('email', {
|
||||||
|
required: 'This is required',
|
||||||
|
})}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
<Box mb={'1rem'}>
|
||||||
|
<FormLabel>Mot de passe</FormLabel>
|
||||||
|
<Input
|
||||||
|
id="pwd"
|
||||||
|
type="password"
|
||||||
|
placeholder="Mot de passe"
|
||||||
|
{...register('password', {
|
||||||
|
required: 'This is required',
|
||||||
|
})}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
<Flex mt={'1rem'} w={'100%'}>
|
||||||
|
<Button onClick={goHome}>Retour</Button>
|
||||||
|
<Spacer/>
|
||||||
|
<Button colorScheme="purple" type="submit">Connexion</Button>
|
||||||
|
</Flex>
|
||||||
|
</FormControl>
|
||||||
|
</form>
|
||||||
|
</Box>
|
||||||
|
</Flex>
|
||||||
|
);
|
||||||
|
|
||||||
|
const LeftSide = () => (
|
||||||
|
<Box flexBasis={'100%'}>
|
||||||
|
<Image
|
||||||
|
h={'100vh'}
|
||||||
|
w={'100%'}
|
||||||
|
src={'/couple_horizon.png'}
|
||||||
|
alt="couple looking at horizon"
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Box>
|
||||||
|
<Flex gap={10}>
|
||||||
|
<LeftSide/>
|
||||||
|
<RightSide/>
|
||||||
|
</Flex>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -9,129 +9,129 @@ import {
|
|||||||
Image,
|
Image,
|
||||||
Input,
|
Input,
|
||||||
Spacer,
|
Spacer,
|
||||||
} from "@chakra-ui/react";
|
} from '@chakra-ui/react';
|
||||||
import { useRouter } from "next/router";
|
import {useRouter} from 'next/router';
|
||||||
import { useForm } from "react-hook-form";
|
import {useForm} from 'react-hook-form';
|
||||||
|
|
||||||
|
type FormValues = {
|
||||||
|
firstName: string
|
||||||
|
lastName: string
|
||||||
|
email: string
|
||||||
|
password: string
|
||||||
|
confirmPassword: string
|
||||||
|
}
|
||||||
|
|
||||||
export default function Register() {
|
export default function Register() {
|
||||||
const {
|
const {
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
register,
|
register,
|
||||||
formState: { errors, isSubmitting },
|
formState: {errors, isSubmitting},
|
||||||
} = useForm();
|
} = useForm();
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const redirect_home = () => {
|
const redirect_home = () => {
|
||||||
router.push("/");
|
router.push('/');
|
||||||
};
|
};
|
||||||
|
|
||||||
const onRegister = async (values) => {
|
const onRegister = async (values: FormValues) => {
|
||||||
// alert(JSON.stringify(values, null, 2));
|
// Verify password
|
||||||
if (values.password !== values.password_bis) {
|
if (values.password !== values.confirmPassword) {
|
||||||
alert("Les mots de passe ne correspondent pas");
|
alert('Les mots de passe ne correspondent pas');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
const response = await fetch("/api/user/", {
|
// Create User
|
||||||
method: "PUT",
|
fetch('/api/user/', {
|
||||||
headers: {
|
method: 'PUT',
|
||||||
"Content-Type": "application/json",
|
headers: {'Content-Type': 'application/json'},
|
||||||
},
|
body: JSON.stringify(values),
|
||||||
body: JSON.stringify(values),
|
}).then(res => res.json()).then(data => {
|
||||||
});
|
if (data.error) throw new Error();
|
||||||
const data = await response.json();
|
alert('Inscription réussie');
|
||||||
if (data.error) {
|
router.push('/');
|
||||||
alert(data.message);
|
}).catch(err => console.error(err));
|
||||||
} else {
|
|
||||||
console.log(data);
|
|
||||||
alert("Inscription réussie");
|
|
||||||
router.push("/");
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const RightSide = () => (
|
const RightSide = () => (
|
||||||
<Flex
|
<Flex
|
||||||
justify={"center"}
|
justify={'center'}
|
||||||
direction={"column"}
|
direction={'column'}
|
||||||
flexBasis={"100%"}
|
flexBasis={'100%'}
|
||||||
align={"center"}
|
align={'center'}
|
||||||
>
|
>
|
||||||
<Heading mb={"2.5rem"}>Inscription</Heading>
|
<Heading mb={'2.5rem'}>Inscription</Heading>
|
||||||
<Box w={"25vw"}>
|
<Box w={'25vw'}>
|
||||||
<form onSubmit={handleSubmit(onRegister)}>
|
<form onSubmit={handleSubmit(onRegister)}>
|
||||||
<FormControl isInvalid={errors.name}>
|
<FormControl isInvalid={errors.name}>
|
||||||
<Flex mb={"1rem"} gap={5}>
|
<Flex mb={'1rem'} gap={5}>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<FormLabel>Prénom</FormLabel>
|
<FormLabel>Prénom</FormLabel>
|
||||||
<Input
|
<Input
|
||||||
id="surname"
|
id="firstName"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Prénom"
|
placeholder="Prénom"
|
||||||
{...register("surname", {
|
{...register('firstName', {
|
||||||
required: "This is required",
|
required: 'This is required',
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<FormLabel>Nom</FormLabel>
|
<FormLabel>Nom</FormLabel>
|
||||||
<Input
|
<Input
|
||||||
id="name"
|
id="lastName"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Nom"
|
placeholder="Nom"
|
||||||
{...register("name", {
|
{...register('lastName', {
|
||||||
required: "This is required",
|
required: 'This is required',
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</Flex>
|
</Flex>
|
||||||
<FormControl mb={"1rem"}>
|
<FormControl mb={'1rem'}>
|
||||||
<FormLabel>Adresse email</FormLabel>
|
<FormLabel>Adresse email</FormLabel>
|
||||||
<Input
|
<Input
|
||||||
id="email"
|
id="email"
|
||||||
type="email"
|
type="email"
|
||||||
placeholder="Adresse@email.com"
|
placeholder="Adresse@email.com"
|
||||||
{...register("email", {
|
{...register('email', {
|
||||||
required: "This is required",
|
required: 'This is required',
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormControl mb={"1rem"}>
|
<FormControl mb={'1rem'}>
|
||||||
<FormLabel>Mot de passe</FormLabel>
|
<FormLabel>Mot de passe</FormLabel>
|
||||||
<Input
|
<Input
|
||||||
id="password"
|
id="password"
|
||||||
type="password"
|
type="password"
|
||||||
placeholder="Mot de passe"
|
placeholder="Mot de passe"
|
||||||
{...register("password", {
|
{...register('password', {
|
||||||
required: "This is required",
|
required: 'This is required',
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
{/* Il y a une margin en trop mais je me suis dit que c'etais mieux d'avoir plus d'expace entre les deux */}
|
{/* Il y a une margin en trop mais je me suis dit que c'etais mieux d'avoir plus d'expace entre les deux */}
|
||||||
<FormControl mb={"1rem"}>
|
<FormControl mb={'1rem'}>
|
||||||
<FormLabel>Confirmation du mot de passe</FormLabel>
|
<FormLabel>Confirmation du mot de passe</FormLabel>
|
||||||
<Input
|
<Input
|
||||||
id="password_bis"
|
id="confirmPassword"
|
||||||
type="password"
|
type="password"
|
||||||
placeholder="Mot de passe"
|
placeholder="Mot de passe"
|
||||||
{...register("password_bis", {
|
{...register('confirmPassword', {
|
||||||
required: "This is required",
|
required: 'This is required',
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormErrorMessage>
|
<FormErrorMessage>
|
||||||
{errors.name && errors.name.message}
|
{/*{errors.name && errors.name.message}*/}
|
||||||
</FormErrorMessage>
|
</FormErrorMessage>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<Flex mt={"1rem"} w={"100%"}>
|
<Flex mt={'1rem'} w={'100%'}>
|
||||||
<Button onClick={redirect_home}>Retour</Button>
|
<Button onClick={redirect_home}>Retour</Button>
|
||||||
<Spacer />
|
<Spacer/>
|
||||||
<Button colorScheme="purple" type="submit" isLoading={isSubmitting}>
|
<Button colorScheme="purple" type="submit" isLoading={isSubmitting}>
|
||||||
Je m'inscris
|
Je m'inscris
|
||||||
</Button>
|
</Button>
|
||||||
</Flex>
|
</Flex>
|
||||||
</form>
|
</form>
|
||||||
@@ -140,11 +140,11 @@ export default function Register() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const LeftSide = () => (
|
const LeftSide = () => (
|
||||||
<Box flexBasis={"100%"}>
|
<Box flexBasis={'100%'}>
|
||||||
<Image
|
<Image
|
||||||
h={"100vh"}
|
h={'100vh'}
|
||||||
w={"100%"}
|
w={'100%'}
|
||||||
src={"/couple_holding_hands.png"}
|
src={'/couple_holding_hands.png'}
|
||||||
alt="couple holding hands"
|
alt="couple holding hands"
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
@@ -153,8 +153,8 @@ export default function Register() {
|
|||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
<Flex gap={10}>
|
<Flex gap={10}>
|
||||||
<LeftSide />
|
<LeftSide/>
|
||||||
<RightSide />
|
<RightSide/>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
Reference in New Issue
Block a user