github refinedev/refine @pankod/refine-supabase@4.1.0

Minor Changes

  • #3528 e8b34442521 Thanks @yildirayunlu! - Updated supabase-js to v2. supabase has published a migration guide. These are some of the changes to refine.

    • Create Supabase client:

    Before:

    import { createClient } from "@supabase/supabase-js";
    
    export const supabaseClient = createClient(SUPABASE_URL, SUPABASE_KEY);

    After:

    import { createClient } from "@supabase/supabase-js";
    
    export const supabaseClient = createClient(SUPABASE_URL, SUPABASE_KEY, {
        db: {
            schema: "public",
        },
        auth: {
            persistSession: true,
        },
    });
    • Sign In method:

    Before:

    const { user, error } = await supabaseClient.auth.signIn({
        email,
        password,
        provider: providerName,
    });

    After:

    const { data, error } = await supabaseClient.auth.signInWithPassword({
        email,
        password,
    });

    with OAuth:

    const { data, error } = await supabaseClient.auth.signInWithOAuth({
        provider: providerName,
    });
    • Sign Up method:

    Before:

    const { user, error } = await supabaseClient.auth.signUp({
        email,
        password,
    });

    After:

    const { data, error } = await supabaseClient.auth.signUp({
        email,
        password,
    });
    • Reset Password with Email

      Before:

      const { data, error } =
          await supabaseClient.auth.api.resetPasswordForEmail(email, {
              redirectTo: `${window.location.origin}/update-password`,
          });

      After:

      const { data, error } = await supabaseClient.auth.resetPasswordForEmail(
          email,
          {
              redirectTo: `${window.location.origin}/update-password`,
          },
      );
    • Update User

    Before:

    const { data, error } = await supabaseClient.auth.update({
        password,
    });

    After:

    const { data, error } = await supabaseClient.auth.updateUser({
        password,
    });
    • Get Sesssion

    Before:

    const session = supabaseClient.auth.session();

    After:

    const { data, error } = await supabaseClient.auth.getSession();
    • Get User

      Before:

      const user = supabaseClient.auth.user();

      After:

      const { data, error } = await supabaseClient.auth.getUser();

Don't miss a new refine release

NewReleases is sending notifications on new releases.