finger

finger
git clone https://git.prime8.dev/finger.git
Log | Files | Refs | README | LICENSE

supabase.ts (662B)


      1 import "react-native-url-polyfill/auto";
      2 import AsyncStorage from "@react-native-async-storage/async-storage";
      3 import { createClient, processLock } from "@supabase/supabase-js";
      4 import { config } from "./config";
      5 import { AppState } from "react-native";
      6 
      7 export const supabase = createClient(config.supabase.url, config.supabase.key, {
      8   auth: {
      9     storage: AsyncStorage,
     10     autoRefreshToken: true,
     11     persistSession: true,
     12     detectSessionInUrl: false,
     13     lock: processLock,
     14   },
     15 });
     16 
     17 AppState.addEventListener("change", (state) => {
     18   if (state === "active") {
     19     supabase.auth.startAutoRefresh();
     20   } else {
     21     supabase.auth.stopAutoRefresh();
     22   }
     23 });