Add API_BASE and fix relative URLs in AdminFoundationManager.tsx
cgen-a9f18f2be64548c78ce27324de5c3d4e
This commit is contained in:
parent
7a870ff3e8
commit
6a10ca27ee
1 changed files with 5 additions and 3 deletions
|
|
@ -1,4 +1,6 @@
|
||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
|
|
||||||
|
const API_BASE = import.meta.env.VITE_API_BASE || "";
|
||||||
import {
|
import {
|
||||||
Card,
|
Card,
|
||||||
CardContent,
|
CardContent,
|
||||||
|
|
@ -94,7 +96,7 @@ export default function AdminFoundationManager() {
|
||||||
const fetchMentors = async () => {
|
const fetchMentors = async () => {
|
||||||
try {
|
try {
|
||||||
setLoadingMentors(true);
|
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");
|
if (!response.ok) throw new Error("Failed to fetch mentors");
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
setMentors(data || []);
|
setMentors(data || []);
|
||||||
|
|
@ -109,7 +111,7 @@ export default function AdminFoundationManager() {
|
||||||
const fetchCourses = async () => {
|
const fetchCourses = async () => {
|
||||||
try {
|
try {
|
||||||
setLoadingCourses(true);
|
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");
|
if (!response.ok) throw new Error("Failed to fetch courses");
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
setCourses(data || []);
|
setCourses(data || []);
|
||||||
|
|
@ -124,7 +126,7 @@ export default function AdminFoundationManager() {
|
||||||
const fetchAchievements = async () => {
|
const fetchAchievements = async () => {
|
||||||
try {
|
try {
|
||||||
setLoadingAchievements(true);
|
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");
|
if (!response.ok) throw new Error("Failed to fetch achievements");
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
setAchievements(data || []);
|
setAchievements(data || []);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue