mirror of
https://github.com/fergalmoran/supanextail.git
synced 2025-12-22 09:17:54 +00:00
Handle sub in dashboard
This commit is contained in:
45
utils/priceList.js
Normal file
45
utils/priceList.js
Normal file
@@ -0,0 +1,45 @@
|
||||
// You can store your price IDs from Stripe here
|
||||
|
||||
const Prices = {
|
||||
personal: {
|
||||
monthly: {
|
||||
id: "price_1J5q2yDMjD0UnVmMXzEWYDnl",
|
||||
desc: "Personal plan (monthly)",
|
||||
},
|
||||
anually: {
|
||||
id: "price_1J5q45DMjD0UnVmMQxXHKGAv",
|
||||
desc: "Personal plan (anually)",
|
||||
},
|
||||
},
|
||||
team: {
|
||||
monthly: {
|
||||
id: "price_1J5q3GDMjD0UnVmMlHc5Eedq",
|
||||
desc: "Team plan (monthly)",
|
||||
},
|
||||
anually: {
|
||||
id: "price_1J5q8zDMjD0UnVmMqsngM91X",
|
||||
desc: "Team plan (anually)",
|
||||
},
|
||||
},
|
||||
pro: {
|
||||
monthly: {
|
||||
id: "price_1J5q3TDMjD0UnVmMJKX3nkDq",
|
||||
desc: "Pro plan (monthly)",
|
||||
},
|
||||
anually: {
|
||||
id: "price_1J5q9VDMjD0UnVmMIQtVDSZ9",
|
||||
desc: "Pro plan (anually)",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const PriceIds = {
|
||||
price_1J5q2yDMjD0UnVmMXzEWYDnl: "Personal plan (monthly)",
|
||||
price_1J5q45DMjD0UnVmMQxXHKGAv: "Personal plan (anually)",
|
||||
price_1J5q3GDMjD0UnVmMlHc5Eedq: "Team plan (monthly)",
|
||||
price_1J5q8zDMjD0UnVmMqsngM91X: "Team plan (anually)",
|
||||
price_1J5q3TDMjD0UnVmMJKX3nkDq: "Pro plan (monthly)",
|
||||
price_1J5q9VDMjD0UnVmMIQtVDSZ9: "Pro plan (anually)",
|
||||
};
|
||||
|
||||
export { Prices, PriceIds };
|
||||
@@ -1,6 +1,16 @@
|
||||
import { createClient } from '@supabase/supabase-js'
|
||||
import { createClient } from "@supabase/supabase-js";
|
||||
|
||||
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL
|
||||
const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY
|
||||
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL;
|
||||
const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;
|
||||
|
||||
export const supabase = createClient(supabaseUrl, supabaseAnonKey)
|
||||
export const supabase = createClient(supabaseUrl, supabaseAnonKey);
|
||||
|
||||
// Check if a user has a paid plan
|
||||
export const getSub = async () => {
|
||||
let { data: subscriptions, error } = await supabase
|
||||
.from("subscriptions")
|
||||
.select("paid_user, plan");
|
||||
if (subscriptions) {
|
||||
return subscriptions;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user