Compare commits

...

1 Commits

Author SHA1 Message Date
review-agent-prime[bot]
71075ea36a Edit packages/lib/customerio.ts 2024-01-30 10:46:08 +00:00

View File

@@ -7,9 +7,8 @@ export const createCustomerIoCustomer = async (user: TUser) => {
return;
}
try {
const auth = Buffer.from(`${env.CUSTOMER_IO_SITE_ID}:${env.CUSTOMER_IO_API_KEY}`).toString("base64");
const res = await fetch(`https://track-eu.customer.io/api/v1/customers/${user.id}`, {
method: "PUT",
method: 'PUT',
headers: {
Authorization: `Basic ${auth}`,
},
@@ -19,9 +18,10 @@ export const createCustomerIoCustomer = async (user: TUser) => {
}),
});
if (res.status !== 200) {
console.log("Error sending user to CustomerIO:", await res.text());
throw new Error(`Error sending user to CustomerIO: ${await res.text()}`);
}
} catch (error) {
console.log("error sending user to CustomerIO:", error);
console.error('Error sending user to CustomerIO:', error.message);
throw error;
}
};