import React from "react"; import Layout from "../components/Layout"; import prisma from '../lib/prisma' import Image from 'next/image'; import * as Yup from 'yup'; import Head from "next/head"; import { getSession, useSession } from "next-auth/react"; import { yupResolver } from "@hookform/resolvers/yup"; import { useForm } from "react-hook-form"; import Router from "next/router"; import style from '../styles/Index.module.css'; import rotatingLeftImage from '../public/images/coffret-degustation-mousselines-individuelles-n3-PhotoRoom.webp'; import rotatingRightImage from '../public/images/coffret-the-PhotoRoom.webp'; import Link from "next/link"; import testerCodeCadeau from '../public/images/testerlecode.webp' import feuilleGauche from '../public/images/feuilleGauche.webp' import feuilleDroite from '../public/images/feuilleBasDroite.webp' import unAnDeThe from '../public/images/unandethé.webp' import sablier from '../public/images/sablier.webp' import cadeau from '../public/images/cadeau.webp' import jeuConcours from '../public/images/jeuconcours.webp' import { GetServerSideProps } from "next"; import { toast } from "react-toastify"; import footerGrass from '../public/images/footer_image.webp' // // doesn't do anything, supposed to add the land in // import "next.config.mjs"; type CodeSubmitForm = { codeCadeau: string; }; const MainPage = () => { const { data: session } = useSession(); const validationSchema = Yup.object().shape({ codeCadeau: Yup.string().trim().required("Veuillez rentrer un code cadeau !"), }); const { register, handleSubmit, formState: { errors } } = useForm({ resolver: yupResolver(validationSchema) }); const onSubmit = async (data: CodeSubmitForm) => { toast.error(errors.codeCadeau?.message, { position: "top-center", autoClose: 5000, hideProgressBar: false, closeOnClick: true, pauseOnHover: true, draggable: true, progress: undefined, theme: "light", }); if (!session) { return

Vous devez vous connecter pour tester votre !

} // try { // const body = { bioValue: data.bio }; // await fetch(`/api/profile`, { // method: "POST", // headers: { "Content-Type": "application/json" }, // body: JSON.stringify(body), // }) // .then((res) => res.json()) // .then((data) => { // setResponse(data); // console.log('response', data); // }) // await Router.push("/profile"); // } catch (error) { // console.error(error); // } }; return ( <> Thé Tip Top
thetiptop feuille Gauche
thetiptop jeu Concours
thetiptop cadeau
thetiptop feuille Droite
thetiptop navigation logo
Code à usage unique
{errors.codeCadeau?.message}
thetiptop feuille Gauche
); }; export default MainPage;