TinyBase logoTinyBase β

getSupabase

The getSupabase method returns a reference to the Supabase client the Store is being persisted with.

getSupabase(): SupabaseClient<any, "public", "public", any, any>
returnsSupabaseClient<any, "public", "public", any, any>

A reference to the Supabase client.

Example

This example creates a Persister object against a newly-created Store and then gets the Supabase client back out again.

import {createClient} from '@supabase/supabase-js';
import {createStore} from 'tinybase';
import {createSupabasePersister} from 'tinybase/persisters/persister-supabase';

const supabase = createClient(
  'https://my-project.supabase.co',
  'anon-key',
);
const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
const persister = createSupabasePersister(store, supabase, 'my_tinybase');

console.log(persister.getSupabase() == supabase);
// -> true

await persister.destroy();

Since

9.6.0