23 lines
732 B
Plaintext
23 lines
732 B
Plaintext
import AkSupa from './aksupa.uts'
|
|
import { SUPA_URL, SUPA_KEY } from '@/ak/config.uts'
|
|
|
|
const supa = new AkSupa(SUPA_URL, SUPA_KEY)
|
|
|
|
// Do not perform hard-coded auto sign-in during page preload (development mode may preload pages).
|
|
// Instead, mark supa as ready if an existing session is present; otherwise defer sign-in to explicit user action.
|
|
const supaReady: Promise<boolean> = (async () => {
|
|
try {
|
|
const sess = supa.getSession();
|
|
if (sess != null && sess.session != null) {
|
|
return true;
|
|
}
|
|
// No session found — do not auto sign-in with hard-coded credentials.
|
|
return true;
|
|
} catch (err) {
|
|
console.error('Supabase instance init failed', err)
|
|
return false;
|
|
}
|
|
})()
|
|
|
|
export { supaReady }
|
|
export default supa |