File tree Expand file tree Collapse file tree 4 files changed +168
-113
lines changed
Expand file tree Collapse file tree 4 files changed +168
-113
lines changed Original file line number Diff line number Diff line change 2020 "@hypr/ui" : " workspace:^" ,
2121 "@hypr/utils" : " workspace:^" ,
2222 "@sentry/react" : " ^8.55.0" ,
23+ "@supabase/supabase-js" : " ^2.58.0" ,
24+ "@t3-oss/env-core" : " ^0.13.8" ,
2325 "@tanstack/react-router" : " ^1.132.41" ,
2426 "@tanstack/react-virtual" : " ^3.13.12" ,
2527 "@tauri-apps/api" : " ^2.8.0" ,
Original file line number Diff line number Diff line change 1+ import { createEnv } from "@t3-oss/env-core" ;
2+ import { z } from "zod" ;
3+
4+ export const env = createEnv ( {
5+ clientPrefix : "VITE_" ,
6+ client : {
7+ VITE_SUPABASE_URL : z . string ( ) . min ( 1 ) ,
8+ VITE_SUPABASE_ANON_KEY : z . string ( ) . min ( 1 ) ,
9+ } ,
10+ runtimeEnv : import . meta. env ,
11+ emptyStringAsUndefined : true ,
12+ } ) ;
Original file line number Diff line number Diff line change 1+ import { createClient , processLock , type SupportedStorage } from "@supabase/supabase-js" ;
2+ import { getCurrentWindow } from "@tauri-apps/api/window" ;
3+
4+ import { env } from "./env" ;
5+
6+ const storage = null as unknown as SupportedStorage ;
7+
8+ export const supabase = createClient ( env . VITE_SUPABASE_URL , env . VITE_SUPABASE_ANON_KEY , {
9+ auth : {
10+ storage,
11+ autoRefreshToken : true ,
12+ persistSession : true ,
13+ detectSessionInUrl : false ,
14+ lock : processLock ,
15+ } ,
16+ } ) ;
17+
18+ const appWindow = getCurrentWindow ( ) ;
19+
20+ appWindow . listen ( "tauri://focus" , ( ) => {
21+ supabase . auth . startAutoRefresh ( ) ;
22+ } ) ;
23+
24+ appWindow . listen ( "tauri://blur" , ( ) => {
25+ supabase . auth . stopAutoRefresh ( ) ;
26+ } ) ;
You can’t perform that action at this time.
0 commit comments