bugfixing
This commit is contained in:
parent
fa274cc01d
commit
8e3ebe2c99
@ -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(
|
||||
|
||||
@ -195,5 +195,4 @@ module.exports = {
|
||||
},
|
||||
},
|
||||
plugins: [require("flowbite/plugin")],
|
||||
darkMode: "class",
|
||||
};
|
||||
|
||||
@ -34,7 +34,6 @@ const config = {
|
||||
brotliSize: true, // Enable Brotli compression
|
||||
},
|
||||
|
||||
|
||||
};
|
||||
|
||||
export default config;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user