foolish-indigoF
Refine2y ago
15 replies
foolish-indigo

Example of register with Supabase and Ant Design's form component?

I need an example of how I could register users where they're able to add extra information that would be added to Supabases' metadata such as name, phone number, etc.

In my authProvider.ts file, I have the following action:
register: async ({ email, password, phone, name }) => {
try {
const { data, error } = await adminSupabaseClient.auth.admin.createUser({
    email,
    email_confirm: true, // No need to verify user's email address.
    password,
    phone,
    user_metadata: { name },
});

if (error) {
    return {
        success: false,
        error,
    };
}

if (data) {
    return {
        success: true,
        redirectTo: '/',
    };
}
} catch (error: any) {
return {
    success: false,
    error,
};
}


I looked at using useForm, but I think it needs to be wrapped with Create, Edit, or Clone?
Was this page helpful?