mirror of
https://github.com/fergalmoran/supanextail.git
synced 2026-01-04 15:44:12 +00:00
Continue typescript integration
This commit is contained in:
17
utils/supabaseClient.tsx
Normal file
17
utils/supabaseClient.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
import { createClient } from '@supabase/supabase-js';
|
||||
|
||||
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL;
|
||||
const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;
|
||||
|
||||
export const supabase = createClient(supabaseUrl || '', supabaseAnonKey || '');
|
||||
|
||||
// Check if a user has a paid plan
|
||||
export const getSub = async () => {
|
||||
const { data: subscriptions } = await supabase
|
||||
.from('subscriptions')
|
||||
.select('paid_user, plan')
|
||||
.single();
|
||||
if (subscriptions) {
|
||||
return subscriptions;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user