diff --git a/src/routes/payment/+server.ts b/src/routes/payment/+server.ts index 4710cc71..88618f80 100644 --- a/src/routes/payment/+server.ts +++ b/src/routes/payment/+server.ts @@ -112,20 +112,30 @@ export const POST = async ({ request, locals }) => { //console.log(tier, payload?.data?.attributes?.product_name) // Update the user and log the payment + try { - + await locals.pb.collection("users").update(userId, { tier, freeTrial: false, lifetime: productName?.includes("Life Time"), }); - const paymentData = { user: userId, data: payload }; await locals.pb.collection("payments").create(paymentData); } catch (dbError) { console.error("Database error:", dbError); - // Depending on your requirements, you might want to propagate this error. + + return new Response( + JSON.stringify({ error: "Pocketbase error" }), + { + status: 500, + headers: { "Content-Type": "application/json" }, + } + + ); + + } return new Response( diff --git a/tailwind.config.cjs b/tailwind.config.cjs index 0371f632..e6cea4e2 100644 --- a/tailwind.config.cjs +++ b/tailwind.config.cjs @@ -195,5 +195,4 @@ module.exports = { }, }, plugins: [require("flowbite/plugin")], - darkMode: "class", }; diff --git a/vite.config.js b/vite.config.js index b384493f..e27d3ad5 100644 --- a/vite.config.js +++ b/vite.config.js @@ -34,7 +34,6 @@ const config = { brotliSize: true, // Enable Brotli compression }, - }; export default config;