From 3ccb7ad7a1fdcb77d795e840a3613d5830b0dcb4 Mon Sep 17 00:00:00 2001 From: Dmytro Kondakov Date: Mon, 14 Apr 2025 11:37:29 +0200 Subject: [PATCH] refactor(network): simplify base URL and clean up validators - Updated the base URL to a fixed production endpoint, removing the conditional logic for development. - Commented out Location and Organizer validations in the eventValidator for future consideration. - Added a console log in getUserImages to assist with backend response tracking. --- frontend/src/network/index.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/frontend/src/network/index.ts b/frontend/src/network/index.ts index 4e5007f..b663255 100644 --- a/frontend/src/network/index.ts +++ b/frontend/src/network/index.ts @@ -19,9 +19,11 @@ type BaseRequestParams = Partial<{ method: "GET" | "POST"; }>; -export const base = import.meta.env.DEV - ? "http://localhost:3040" - : "https://haystack.johncosta.tech"; +// export const base = import.meta.env.DEV +// ? "http://localhost:3040" +// : "https://haystack.johncosta.tech"; + +export const base = "https://haystack.johncosta.tech"; const getBaseRequest = ({ path, body, method }: BaseRequestParams): Request => { return new Request(`${base}/${path}`, { @@ -89,9 +91,9 @@ const eventValidator = strictObject({ EndDateTime: nullable(pipe(string())), Description: nullable(string()), LocationID: nullable(pipe(string(), uuid())), - Location: nullable(locationValidator), + // Location: nullable(locationValidator), OrganizerID: nullable(pipe(string(), uuid())), - Organizer: nullable(contactValidator), + // Organizer: nullable(contactValidator), }); const noteValidator = strictObject({ @@ -136,6 +138,8 @@ export const getUserImages = async (): Promise => { const res = await fetch(request).then((res) => res.json()); + console.log("BACKEND RESPONSE: ", res); + return parse(getUserImagesResponseValidator, res); };