From e97bc7c88bbca51fca580bb7f065353a7982fe62 Mon Sep 17 00:00:00 2001 From: sassanix <39465071+sassanix@users.noreply.github.com> Date: Sat, 1 Mar 2025 23:03:39 -0400 Subject: [PATCH] Fixing the fetch error for warranties database --- frontend/script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/script.js b/frontend/script.js index 26fc1a9..5fa26fb 100644 --- a/frontend/script.js +++ b/frontend/script.js @@ -18,7 +18,7 @@ let warranties = []; let currentWarrantyId = null; // API URL -const API_URL = 'http://localhost:5000/api/warranties'; +const API_URL = '/api/warranties'; // CORRECTED API_URL (relative URL) // Event Listeners document.addEventListener('DOMContentLoaded', () => { @@ -109,7 +109,7 @@ async function loadWarranties() { showLoading(); try { - const response = await fetch(API_URL); + const response = await fetch(API_URL); // This fetch call now uses the CORRECTED API_URL if (!response.ok) { throw new Error('Failed to load warranties'); }