Skip to content

Commit

Permalink
Fixed some eslint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
maurer2 committed Jan 9, 2024
1 parent d5149e7 commit a3f231d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"author": "Martin",
"scripts": {
"preinstall": "npx only-allow pnpm",
"dev": "next dev",
"dev2": "turbo dev",
"dev": "next dev --turbo",
"build": "next build",
"start": "next start",
"lint": "next lint",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { redirect } from 'next/navigation';

import type { FormValues } from '../../../types/pizza';

import { pizzaFormValidationSchema } from '../../../schema/pizza/validation';

export async function handleFormValuesSubmit(formValues: FormValues) {
Expand All @@ -16,5 +17,5 @@ export async function handleFormValuesSubmit(formValues: FormValues) {
}
}

redirect('/pizza/success');
return redirect('/pizza/success');
}
7 changes: 3 additions & 4 deletions src/components/PizzaForm/PizzaForm.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
'use client'

import type { FormEvent } from 'react';
import { useState } from 'react';

import { zodResolver } from '@hookform/resolvers/zod';
import { clsx } from 'clsx';
import React, { useEffect } from 'react';
import React, { useEffect , useState } from 'react';
import { FormProvider, useForm } from 'react-hook-form';

import type { FormValues } from '../../types/pizza';
Expand Down Expand Up @@ -45,10 +44,10 @@ const PizzaForm = ({ defaultValues, formSettings }: PizzaFormProps) => {
// https://github.com/vercel/next.js/discussions/51371#discussioncomment-7152123
setIsPending(true);

const errors = await handleFormValuesSubmit(formValues);
const currentServerSideErrors = await handleFormValuesSubmit(formValues);

setIsPending(false);
setServerSideErrors(errors?.errors);
setServerSideErrors(currentServerSideErrors?.errors);
};

const handleReset = (event: FormEvent<HTMLFormElement>): void => {
Expand Down

0 comments on commit a3f231d

Please sign in to comment.