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)
|
//console.log(tier, payload?.data?.attributes?.product_name)
|
||||||
|
|
||||||
// Update the user and log the payment
|
// Update the user and log the payment
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
await locals.pb.collection("users").update(userId, {
|
await locals.pb.collection("users").update(userId, {
|
||||||
tier,
|
tier,
|
||||||
freeTrial: false,
|
freeTrial: false,
|
||||||
lifetime: productName?.includes("Life Time"),
|
lifetime: productName?.includes("Life Time"),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
const paymentData = { user: userId, data: payload };
|
const paymentData = { user: userId, data: payload };
|
||||||
await locals.pb.collection("payments").create(paymentData);
|
await locals.pb.collection("payments").create(paymentData);
|
||||||
} catch (dbError) {
|
} catch (dbError) {
|
||||||
console.error("Database error:", 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(
|
return new Response(
|
||||||
|
|||||||
@ -195,5 +195,4 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
plugins: [require("flowbite/plugin")],
|
plugins: [require("flowbite/plugin")],
|
||||||
darkMode: "class",
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -34,7 +34,6 @@ const config = {
|
|||||||
brotliSize: true, // Enable Brotli compression
|
brotliSize: true, // Enable Brotli compression
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user