0
Dynamic Form Example

Example of a Typeform-like dynamic form made with Windmill. Tutorial at https://www.youtube.com/watch?v=MTGZTO1AduM

Created by henri186 115 days ago
Static preview only: No backend 
This is a static preview of the app and there is no backend. As such, the interactivity requiring script execution is non functional. To see the fully functional app, edit/run it in Windmil by clicking the button above.
Loading

Scripts used

import { createClient } from "npm:@supabase/supabase-js";

// Define the Supabase resource type as specified
type Supabase = {
  key: string;
  url: string;
};

export async function main(
  supabaseResource: Supabase,
  tableName: string,
  rowData: Record<string, any>,
) {
  // Initialize the Supabase client
  const supabase = createClient(supabaseResource.url, supabaseResource.key);

  // Insert a row into the specified table
  const { data, error } = await supabase
    .from(tableName)
    .insert([rowData]);

  // Return the result or throw an error if the operation failed
  if (error) {
    throw error;
  }

  return data;
}