From 6a10ca27eead941a9047aa3f48bb6d5d98f99cf2 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Thu, 13 Nov 2025 02:57:09 +0000 Subject: [PATCH] Add API_BASE and fix relative URLs in AdminFoundationManager.tsx cgen-a9f18f2be64548c78ce27324de5c3d4e --- client/components/admin/AdminFoundationManager.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/components/admin/AdminFoundationManager.tsx b/client/components/admin/AdminFoundationManager.tsx index 40df2c90..e01d6ca8 100644 --- a/client/components/admin/AdminFoundationManager.tsx +++ b/client/components/admin/AdminFoundationManager.tsx @@ -1,4 +1,6 @@ import React, { useState, useEffect } from "react"; + +const API_BASE = import.meta.env.VITE_API_BASE || ""; import { Card, CardContent, @@ -94,7 +96,7 @@ export default function AdminFoundationManager() { const fetchMentors = async () => { try { setLoadingMentors(true); - const response = await fetch("/api/admin/foundation/mentors"); + const response = await fetch(`${API_BASE}/api/admin/foundation/mentors`); if (!response.ok) throw new Error("Failed to fetch mentors"); const data = await response.json(); setMentors(data || []); @@ -109,7 +111,7 @@ export default function AdminFoundationManager() { const fetchCourses = async () => { try { setLoadingCourses(true); - const response = await fetch("/api/admin/foundation/courses"); + const response = await fetch(`${API_BASE}/api/admin/foundation/courses`); if (!response.ok) throw new Error("Failed to fetch courses"); const data = await response.json(); setCourses(data || []); @@ -124,7 +126,7 @@ export default function AdminFoundationManager() { const fetchAchievements = async () => { try { setLoadingAchievements(true); - const response = await fetch("/api/admin/foundation/achievements"); + const response = await fetch(`${API_BASE}/api/admin/foundation/achievements`); if (!response.ok) throw new Error("Failed to fetch achievements"); const data = await response.json(); setAchievements(data || []);