mirror of
https://github.com/fergalmoran/supanextail.git
synced 2025-12-22 09:17:54 +00:00
Fix missing column in SQL and fix plan display in the dashboard
This commit is contained in:
@@ -82,12 +82,14 @@ export async function getServerSideProps(context: NextPageContext) {
|
|||||||
if (user) {
|
if (user) {
|
||||||
const { data: plan } = await supabaseAdmin
|
const { data: plan } = await supabaseAdmin
|
||||||
.from('subscriptions')
|
.from('subscriptions')
|
||||||
.select('plan')
|
.select('subscription')
|
||||||
.eq('id', user.id)
|
.eq('id', user.id)
|
||||||
.single();
|
.single();
|
||||||
|
|
||||||
// Check the subscription plan. If it doesnt exist, return null
|
// Check the subscription plan. If it doesnt exist, return null
|
||||||
const subscription = plan?.plan ? await stripe.subscriptions.retrieve(plan.plan) : null;
|
const subscription = plan?.subscription
|
||||||
|
? await stripe.subscriptions.retrieve(plan.subscription)
|
||||||
|
: null;
|
||||||
|
|
||||||
const { data: profile } = await supabaseAdmin
|
const { data: profile } = await supabaseAdmin
|
||||||
.from('profiles')
|
.from('profiles')
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ create table profiles (
|
|||||||
username text unique,
|
username text unique,
|
||||||
avatar_url text,
|
avatar_url text,
|
||||||
website text,
|
website text,
|
||||||
|
customerId text,
|
||||||
|
|
||||||
primary key (id),
|
primary key (id),
|
||||||
unique(username),
|
unique(username),
|
||||||
|
|||||||
@@ -14,8 +14,6 @@ export const AuthProvider = ({ children }) => {
|
|||||||
// Check active sessions and sets the user
|
// Check active sessions and sets the user
|
||||||
const session = supabase.auth.session();
|
const session = supabase.auth.session();
|
||||||
|
|
||||||
console.log(session);
|
|
||||||
|
|
||||||
setUser(session?.user ?? null);
|
setUser(session?.user ?? null);
|
||||||
setSession(session ?? null);
|
setSession(session ?? null);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user