1
0
mirror of https://github.com/Fayorg/calendrier-avant.git synced 2026-05-28 01:28:37 +02:00

feat: prisma fix

This commit is contained in:
2023-12-04 10:23:31 +01:00
parent 91b0c04208
commit a637ab23e7
4 changed files with 24 additions and 6 deletions

View File

@@ -1,8 +1,6 @@
import type { NextApiRequest, NextApiResponse } from 'next'
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
import prisma from '@lib/prisma';
interface IBody {
key: string

View File

@@ -7,17 +7,21 @@ export default function play() {
const [grade, setGrade] = useState<number>(0);
const router = useRouter();
let voted;
let password: string | null;
const [password, setPassword] = useState<string | null>('');
useEffect(() => {
password = localStorage.getItem('@password');
const pass = localStorage.getItem('@password');
setPassword(pass);
voted = localStorage.getItem('@voted');
if (!password) {
if (!pass) {
router.push('/');
}
}, []);
async function handleSubmit(event: React.FormEvent<HTMLFormElement>) {
event.preventDefault();
console.log(grade, password);
const response = await fetch('/api/grade', {
method: 'POST',
headers: {