mirror of
https://github.com/jordienr/zenblog.git
synced 2026-09-28 01:56:07 -04:00
fix tb collectionname
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user