Supbase login + waiting list page
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
export async function handleAuthChange(event, session) {
|
||||
await fetch('/api/auth', {
|
||||
method: 'POST',
|
||||
headers: new Headers({ 'Content-Type': 'application/json' }),
|
||||
credentials: 'same-origin',
|
||||
body: JSON.stringify({ event, session }),
|
||||
});
|
||||
}
|
||||
@@ -1,8 +1,24 @@
|
||||
import { createClient } from '@supabase/supabase-js';
|
||||
|
||||
import config from '../../config';
|
||||
let _supabase;
|
||||
|
||||
export const supabase = createClient(
|
||||
config.supabaseConfig.url,
|
||||
config.supabaseConfig.anonKey
|
||||
);
|
||||
export const getSupabase = (config) => {
|
||||
if (_supabase) return _supabase;
|
||||
|
||||
if (!config && process && process.env) {
|
||||
config = {
|
||||
isProd: process.env.NODE_ENV === 'development',
|
||||
supabaseConfig: {
|
||||
url: process.env.SVELTE_APP_SUPABASE_URL,
|
||||
anonKey: process.env.SVELTE_APP_SUPABASE_ANON_KEY,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
_supabase = createClient(
|
||||
config.supabaseConfig.url,
|
||||
config.supabaseConfig.anonKey
|
||||
);
|
||||
|
||||
return _supabase;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
import { writable } from 'svelte/store';
|
||||
|
||||
export const user = writable(false);
|
||||
export const profile = writable(false);
|
||||
Reference in New Issue
Block a user