Skip to content

Commit f5e326f

Browse files
committed
credit top up logic fix
1 parent dd1aa70 commit f5e326f

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

src/components/interactive/CreditSection.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ export default function CreditSection({ directusUrl, className }: Props) {
8787
<CardHeader>
8888
<div className="flex items-center justify-between">
8989
<CardTitle>
90-
{credits?.remaining || 0}/{totalCredits} credits remaining
90+
{credits?.remaining || 0}/{totalCredits} credits available
9191
</CardTitle>
92-
<Button
92+
<Button
9393
variant="secondary"
9494
size="sm"
9595
onClick={() => window.location.href = '/dashboard/role-fit-index/top-up/'}

src/components/interactive/TopUpCard.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,19 +123,23 @@ export default function TopUpCard({
123123

124124
const meData = await meRes.json();
125125
const email = meData.data.email;
126-
console.log(email)
126+
console.log(email);
127+
const userId = meData.data.id;
127128

129+
// stripe checkout button
128130
const webhookUrl = "https://n8n.bounteer.com/webhook/9d62c0a4-4078-4ba4-b2a8-6d4f6982d339";
129131
// const webhookUrl = "https://n8n.bounteer.com/webhook-test/9d62c0a4-4078-4ba4-b2a8-6d4f6982d339";
130132
const params = new URLSearchParams({
131-
product_id: String(p.stripe_product_id),
132-
id: String(p.id),
133+
user: String(userId),
134+
product: String(p.id),
135+
stripe_product_id: String(p.stripe_product_id),
133136
email: email,
134137

135138
});
136139

140+
// todo failed to fetch below
137141
const res = await fetch(`${webhookUrl}?${params.toString()}`, {
138-
method: "GET",
142+
method: "POST",
139143
});
140144

141145
if (!res.ok) {

src/pages/logout.astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
}
5454
}
5555

56+
// TODO check how I can enforce react client hyration
5657
// Execute logout when page loads
5758
if (typeof window !== "undefined") {
5859
performLogout();

0 commit comments

Comments
 (0)