From 319e68ae56b26966c8866b0fa0b200e0d3e5d34d Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Thu, 13 Nov 2025 02:59:05 +0000 Subject: [PATCH] Add API_BASE and fix URLs in Status.tsx cgen-b0ba8ff0fb1a4188bc26e6e10d23a0e6 --- client/pages/Community.tsx | 4 +++- client/pages/Status.tsx | 4 +++- client/pages/Web3Callback.tsx | 6 ++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/client/pages/Community.tsx b/client/pages/Community.tsx index 5102c7f8..f53fcd9b 100644 --- a/client/pages/Community.tsx +++ b/client/pages/Community.tsx @@ -1,5 +1,7 @@ import Layout from "@/components/Layout"; import SEO from "@/components/SEO"; + +const API_BASE = import.meta.env.VITE_API_BASE || ""; import { Button } from "@/components/ui/button"; import { Card, @@ -1813,7 +1815,7 @@ export default function Community() { } try { - const resp = await fetch("/api/moderation/reports", { + const resp = await fetch(`${API_BASE}/api/moderation/reports`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ diff --git a/client/pages/Status.tsx b/client/pages/Status.tsx index fecdf5ea..30817be7 100644 --- a/client/pages/Status.tsx +++ b/client/pages/Status.tsx @@ -1,4 +1,6 @@ import { useState, useEffect } from "react"; + +const API_BASE = import.meta.env.VITE_API_BASE || ""; import Layout from "@/components/Layout"; import { Card, @@ -66,7 +68,7 @@ export default function Status() { const fetchStatus = async () => { try { - const resp = await fetch("/api/status"); + const resp = await fetch(`${API_BASE}/api/status`); if (!resp.ok) throw new Error("Status API failed"); const data = await resp.json(); const mappedMetrics: SystemMetric[] = ( diff --git a/client/pages/Web3Callback.tsx b/client/pages/Web3Callback.tsx index 82db41af..fbc4d251 100644 --- a/client/pages/Web3Callback.tsx +++ b/client/pages/Web3Callback.tsx @@ -1,4 +1,6 @@ import { useEffect, useState } from "react"; + +const API_BASE = import.meta.env.VITE_API_BASE || ""; import { useNavigate } from "react-router-dom"; import { useWeb3 } from "@/contexts/Web3Context"; import { useAuth } from "@/contexts/AuthContext"; @@ -19,7 +21,7 @@ export default function Web3Callback() { setIsProcessing(true); try { // Generate a nonce from the backend - const nonceResponse = await fetch("/api/web3/nonce", { + const nonceResponse = await fetch(`${API_BASE}/api/web3/nonce`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ wallet_address: account }), @@ -38,7 +40,7 @@ export default function Web3Callback() { const signature = await signMessage(message); // Verify signature on backend and create/link account - const verifyResponse = await fetch("/api/web3/verify", { + const verifyResponse = await fetch(`${API_BASE}/api/web3/verify`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({