🚨 stash apply
This commit is contained in:
1 parent
24cca03a10
commit
f1a9f5e2f4
26 files changed
+214
-644
No files matched your search
+7
-32
@@ -1,37 +1,16 @@
|
||||
import React, { useEffect, useState, useSyncExternalStore } from "react";
|
||||
import React, { useState } from "react";
|
||||
import prisma from '../lib/prisma'
|
||||
|
||||
|
||||
import Image from 'next/image';
|
||||
import * as Yup from 'yup';
|
||||
import Head from "next/head";
|
||||
import { getCsrfToken, getSession, signIn, useSession } from "next-auth/react";
|
||||
import { getSession, useSession } from "next-auth/react";
|
||||
import { yupResolver } from "@hookform/resolvers/yup";
|
||||
import "yup-phone";
|
||||
import { SubmitHandler, useForm } from "react-hook-form";
|
||||
|
||||
import { AiOutlineCheck } from 'react-icons/ai'
|
||||
|
||||
import Router from "next/router";
|
||||
|
||||
|
||||
import { useForm } from "react-hook-form";
|
||||
import style from '../styles/Connexion.module.css';
|
||||
|
||||
import imageConnexion from '../public/images/connexion_image.png'
|
||||
|
||||
|
||||
import Link from "next/link";
|
||||
|
||||
|
||||
|
||||
import { TfiInfoAlt } from 'react-icons/tfi'
|
||||
import { TfiGift } from 'react-icons/tfi'
|
||||
import { toast } from "react-toastify";
|
||||
import { Token } from "nodemailer/lib/xoauth2";
|
||||
import { isGeneratorFunction } from "util/types";
|
||||
import { UserProps } from "../types/user";
|
||||
import { UserGainProps } from "../types/userGain";
|
||||
import { Gain, Produit, User } from "@prisma/client";
|
||||
import { Gain, User } from "@prisma/client";
|
||||
|
||||
type FormData = {
|
||||
email: string;
|
||||
@@ -44,7 +23,6 @@ type FormData = {
|
||||
|
||||
export async function getServerSideProps(context) {
|
||||
const session = await getSession(context)
|
||||
|
||||
if (!session) {
|
||||
return {
|
||||
redirect: {
|
||||
@@ -53,13 +31,11 @@ export async function getServerSideProps(context) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const user = await prisma.user.findUnique({
|
||||
where: {
|
||||
email: session?.user.email
|
||||
}
|
||||
});
|
||||
|
||||
const userGains = await prisma.gain.findMany({
|
||||
where: {
|
||||
userId: user.id
|
||||
@@ -83,9 +59,8 @@ type Props = {
|
||||
}
|
||||
|
||||
const MonCompte = (props: Props) => {
|
||||
|
||||
const { data: session, status } = useSession();
|
||||
const [response, setResponse] = useState(null)
|
||||
const { data: session } = useSession();
|
||||
const [, setResponse] = useState(null)
|
||||
|
||||
const validationSchema = Yup.object().shape({
|
||||
name: Yup.string()
|
||||
@@ -105,7 +80,7 @@ const MonCompte = (props: Props) => {
|
||||
.phone("FR", true, "le numéro de téléphone est invalide")
|
||||
});
|
||||
|
||||
const { register, setValue, handleSubmit, formState: { errors } } = useForm<FormData>({
|
||||
const { register, handleSubmit, formState: { errors } } = useForm<FormData>({
|
||||
resolver: yupResolver(validationSchema)
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user