diff --git a/src/app/[locale]/(unauth)/guestbook/page.tsx b/src/app/[locale]/(unauth)/guestbook/page.tsx index c96f983e9..cd181a4f7 100644 --- a/src/app/[locale]/(unauth)/guestbook/page.tsx +++ b/src/app/[locale]/(unauth)/guestbook/page.tsx @@ -3,7 +3,7 @@ import { useTranslations } from 'next-intl'; import { getTranslations } from 'next-intl/server'; import { Suspense } from 'react'; -import { GuestbookForm } from '@/components/GuestbookForm'; +import { AddGuestbookForm } from '@/components/AddGuestbookForm'; import { GuestbookList } from '@/components/GuestbookList'; export async function generateMetadata(props: { params: { locale: string } }) { @@ -23,7 +23,7 @@ const Guestbook = () => { return ( <> - + {t('loading_guestbook')}

}> diff --git a/src/components/AddGuestbookForm.tsx b/src/components/AddGuestbookForm.tsx new file mode 100644 index 000000000..0aa505763 --- /dev/null +++ b/src/components/AddGuestbookForm.tsx @@ -0,0 +1,19 @@ +'use client'; + +import { GuestbookForm } from './GuestbookForm'; + +const AddGuestbookForm = () => ( + { + await fetch(`/api/guestbook`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(data), + }); + }} + /> +); + +export { AddGuestbookForm }; diff --git a/src/components/EditableGuestbookEntry.tsx b/src/components/EditableGuestbookEntry.tsx index 7ca47b9d8..96d72aca2 100644 --- a/src/components/EditableGuestbookEntry.tsx +++ b/src/components/EditableGuestbookEntry.tsx @@ -15,10 +15,6 @@ const EditableGuestbookEntry = (props: { setIsEditing((value) => !value); }; - const handleStopEditing = () => { - setIsEditing(false); - }; - return ( <>