Supbase login + waiting list page

This commit is contained in:
rotimi-best
2021-07-31 23:06:14 +03:00
parent 302b2eb37b
commit 4ebd98657f
31 changed files with 7488 additions and 397 deletions
+8
View File
@@ -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 }),
});
}
+21 -5
View File
@@ -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;
};