Skip to content

Commit

Permalink
style: applied prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Nov 14, 2023
1 parent ef8d26a commit 10d50aa
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions supabase/functions/checkSubscription/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { createClient } = require("@supabase/supabase-js");
const supabase = createClient(SUPABASE_URL, SUPABASE_ANON_KEY);
const stripe = require('stripe')(STRIPE_SECRET_KEY);
const stripe = require("stripe")(STRIPE_SECRET_KEY);

module.exports = async (req, res) => {
const userId = req.query.userId || req.body.userId;
Expand All @@ -11,9 +11,9 @@ module.exports = async (req, res) => {

// Fetch subscription info from Supabase
const { data, error } = await supabase
.from('user_subscriptions')
.select('subscription_id')
.eq('user_id', userId);
.from("user_subscriptions")
.select("subscription_id")
.eq("user_id", userId);

if (error || !data || !data.length) {
return res.status(404).send("Subscription not found");
Expand All @@ -24,9 +24,9 @@ module.exports = async (req, res) => {
// Validate subscription with Stripe
const subscription = await stripe.subscriptions.retrieve(subscriptionId);

if (!subscription || subscription.status !== 'active') {
if (!subscription || subscription.status !== "active") {
return res.status(403).send("Subscription is not active");
}

return res.status(200).json({ status: 'active' });
return res.status(200).json({ status: "active" });
};

0 comments on commit 10d50aa

Please sign in to comment.