From cac9bd13508e77f5770806e2455934c3f2366e65 Mon Sep 17 00:00:00 2001 From: "bitbuilder-ai[bot]" <65095814+bitbuilder-ai[bot]@users.noreply.github.com> Date: Sat, 7 Oct 2023 13:45:26 +0000 Subject: [PATCH] implement #28; --- src/pages/forms/[id].tsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/pages/forms/[id].tsx b/src/pages/forms/[id].tsx index 283abdb..bfaf295 100644 --- a/src/pages/forms/[id].tsx +++ b/src/pages/forms/[id].tsx @@ -15,6 +15,17 @@ import { Database } from '../../../types/supabase'; import ResponsesTable from '../../components/home/modes/ResponsesTable'; export default function FormDetailPage() { +const closeForm = async () => { + const { data, error } = await supabase + .from('forms') + .update({ is_open: false }) + .eq('id', form.id); + if (error) { + console.error('Error closing form:', error); + } else { + setForm(data[0]); + } +}; const { isLoading: isSessionLoading, session, error } = useSessionContext(); const supabase = createClientComponentClient(); const [user, setUser] = useState(null); @@ -83,6 +94,9 @@ export default function FormDetailPage() { View live form + {form.created_at && (

@@ -151,4 +165,4 @@ function respectNewLines(text: string | null | undefined) {
)); -} +} \ No newline at end of file