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