
import { supabase } from '@/integrations/supabase/client';

/**
 * Invokes the sync-auth-users edge function to synchronize auth users
 * with the public.users table.
 */
export async function syncSupabaseAuthUsers() {
  try {
    const { data, error } = await supabase.functions.invoke('sync-auth-users', {
      method: 'POST',
    });
    
    if (error) throw error;
    return data;
  } catch (err) {
    console.error("Error syncing auth users:", err);
    return { success: false, error: err.message };
  }
}
