From 9705b55e489c62a45b025da8f0cb021daf10df6a Mon Sep 17 00:00:00 2001 From: Yair Dovrat Date: Tue, 28 May 2024 16:42:10 +0200 Subject: [PATCH] better handle endpoint --- src/index.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/index.ts b/src/index.ts index a97c86d..1704da6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -143,12 +143,11 @@ export default async function (manager: Manager, settings: ComponentSettings) { events: [eventData], } - const amplitudeEndpoint = (settings: ComponentSettings): string => { - return settings.eu_data - ? 'https://api.eu.amplitude.com/2/httpapi' - : 'https://api2.amplitude.com/2/httpapi' - } - manager.fetch(`${amplitudeEndpoint(settings)}`, { + const endpoint = settings.eu_data + ? 'https://api.eu.amplitude.com/2/httpapi' + : 'https://api2.amplitude.com/2/httpapi' + + manager.fetch(endpoint, { method: 'POST', headers: { 'Content-Type': 'application/json',