From 3c1f6ba40f5df7e56c3aefa31e52eaad3b587e98 Mon Sep 17 00:00:00 2001 From: Dmytro Kondakov Date: Mon, 14 Apr 2025 10:56:32 +0200 Subject: [PATCH] fix(network): update base URL for development and production environments - Changed the base URL to use localhost for development and the production URL for other environments. - Added Location validation back into the eventValidator and removed commented-out code for clarity. - Cleaned up debugging logs in getUserImages function. --- frontend/src/network/index.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/frontend/src/network/index.ts b/frontend/src/network/index.ts index 5d4a9fe..4e5007f 100644 --- a/frontend/src/network/index.ts +++ b/frontend/src/network/index.ts @@ -19,7 +19,9 @@ type BaseRequestParams = Partial<{ method: "GET" | "POST"; }>; -export const base = "https://haystack.johncosta.tech"; +export const base = import.meta.env.DEV + ? "http://localhost:3040" + : "https://haystack.johncosta.tech"; const getBaseRequest = ({ path, body, method }: BaseRequestParams): Request => { return new Request(`${base}/${path}`, { @@ -87,9 +89,9 @@ const eventValidator = strictObject({ EndDateTime: nullable(pipe(string())), Description: nullable(string()), LocationID: nullable(pipe(string(), uuid())), + Location: nullable(locationValidator), OrganizerID: nullable(pipe(string(), uuid())), - // Location: nullable(locationValidator), - // Organizer: nullable(contactValidator), + Organizer: nullable(contactValidator), }); const noteValidator = strictObject({ @@ -132,12 +134,8 @@ export type UserImage = InferOutput; export const getUserImages = async (): Promise => { const request = getBaseAuthorizedRequest({ path: "image" }); - console.log("DBG: ", request); - const res = await fetch(request).then((res) => res.json()); - console.log("DBG: ", res); - return parse(getUserImagesResponseValidator, res); };