diff --git a/src/pages/forms/[id].tsx b/src/pages/forms/[id].tsx index 283abdb..c009560 100644 --- a/src/pages/forms/[id].tsx +++ b/src/pages/forms/[id].tsx @@ -78,6 +78,20 @@ export default function FormDetailPage() { + { + const { error } = await supabase + .from('forms') + .update({ is_open: !form.is_open }) + .eq('id', form.id); + if (error) { + console.error('Error updating form status:', error); + } else { + setForm({ ...form, is_open: !form.is_open }); + } + }}> + {form.is_open ? 'Close form' : 'Open form'} + + View live form @@ -151,4 +165,4 @@ function respectNewLines(text: string | null | undefined) { )); -} +} \ No newline at end of file