fix tb collectionname

This commit is contained in:
Jordi Enric
2024-05-03 20:01:20 +02:00
parent 40e6acfaf3
commit 6bd55f2f2e
+14 -17
View File
@@ -9,23 +9,20 @@ export function sendViewEvent({
post_slug: string;
post_title: string;
}) {
fetch(
"https://api.eu-central-1.aws.tinybird.co/v0/events?name=events_example",
{
method: "POST",
body: JSON.stringify({
timestamp: new Date().toISOString(),
blog_id,
post_id,
post_slug,
post_title,
event_type: "post_view",
}),
headers: {
Authorization: `Bearer ${process.env.TINYBIRD_TOKEN}`,
},
}
).then((res) => {
fetch("https://api.eu-central-1.aws.tinybird.co/v0/events?name=post_events", {
method: "POST",
body: JSON.stringify({
timestamp: new Date().toISOString(),
blog_id,
post_id,
post_slug,
post_title,
event_type: "post_view",
}),
headers: {
Authorization: `Bearer ${process.env.TINYBIRD_TOKEN}`,
},
}).then((res) => {
if (!res.ok) {
throw new Error("Failed to send event");
}