Add API_BASE and fix URLs in Status.tsx

cgen-b0ba8ff0fb1a4188bc26e6e10d23a0e6
This commit is contained in:
Builder.io 2025-11-13 02:59:05 +00:00
parent f5a750236d
commit 319e68ae56
3 changed files with 10 additions and 4 deletions

View file

@ -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({

View file

@ -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[] = (

View file

@ -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({