diff --git a/src/app/admin/forms/edit/[id]/page.tsx b/src/app/admin/forms/edit/[id]/page.tsx index 5eb4096b..65a2dd6f 100644 --- a/src/app/admin/forms/edit/[id]/page.tsx +++ b/src/app/admin/forms/edit/[id]/page.tsx @@ -1,13 +1,13 @@ -import { getForm } from '@/features/form/api/form'; -import { getCachedToken } from '@/features/user/api/mcToken'; -import { getUser } from '@/features/user/api/user'; import { isRight } from 'fp-ts/lib/Either'; import { redirect } from 'next/navigation'; import { redirectOrDoNothing } from '@/app/error/RedirectByErrorResponse'; import styles from '@/app/page.module.css'; -import NavBar from '@/components/NavBar'; import DashboardMenu from '@/components/DashboardMenu'; +import NavBar from '@/components/NavBar'; +import { getForm } from '@/features/form/api/form'; import { EditFormComponent } from '@/features/form/components/editForm'; +import { getCachedToken } from '@/features/user/api/mcToken'; +import { getUser } from '@/features/user/api/user'; const Home = async ({ params }: { params: { id: number } }) => { const token = (await getCachedToken()) ?? ''; diff --git a/src/features/form/components/editForm.tsx b/src/features/form/components/editForm.tsx index 1c32820f..eab176b3 100644 --- a/src/features/form/components/editForm.tsx +++ b/src/features/form/components/editForm.tsx @@ -1,10 +1,12 @@ 'use client'; -import { Option, none, some } from 'fp-ts/lib/Option'; -import { UseFormRegister, useForm } from 'react-hook-form'; import { Box, FormGroup, Select } from '@material-ui/core'; import { Stack, TextField } from '@mui/material'; -import { Form } from '../types/formSchema'; +import { none, some } from 'fp-ts/lib/Option'; +import { useForm } from 'react-hook-form'; +import type { Form } from '../types/formSchema'; +import type { Option } from 'fp-ts/lib/Option'; +import type { UseFormRegister } from 'react-hook-form'; interface IForm { form_id: Option; @@ -73,8 +75,8 @@ const FormMetaComponent = ({ ); }; -export const EditFormComponent = async ({ form }: { form: Form }) => { - const { register, handleSubmit, control } = useForm({ +export const EditFormComponent = ({ form }: { form: Form }) => { + const { register } = useForm({ defaultValues: { form_id: some(form.id), form_title: none,