···99import { Helmet } from 'react-helmet';
1010import { useAuth } from '../../contexts/AuthContext';
11111212+// Define the backend API base URL
1313+const API_BASE_URL = 'https://api.cred.blue';
1414+1215const CollectionsFeed = () => {
1316 const { username } = useParams();
1417 const navigate = useNavigate();
···145148 const maxPages = isInitialDeepLoad ? 1000 : 1;
146149147150 while (hasMoreRecords && pageCount < maxPages && !reachedCutoff) {
148148- // Use our server-side API to fetch records
149149- let url = `/api/collections/${encodeURIComponent(userDid)}/records?endpoint=${encodeURIComponent(endpoint)}&collection=${encodeURIComponent(collection)}&limit=100`;
151151+ // Use our server-side API to fetch records - Use absolute URL
152152+ let url = `${API_BASE_URL}/api/collections/${encodeURIComponent(userDid)}/records?endpoint=${encodeURIComponent(endpoint)}&collection=${encodeURIComponent(collection)}&limit=100`;
150153151154 // Add cursor if we have one
152155 if (cursor) {
···385388 // Continue without profile data, not critical
386389 }
387390388388- // Use our server-side API to fetch collections
391391+ // Use our server-side API to fetch collections - Use absolute URL
389392 try {
390390- const collectionsResponse = await fetch(`/api/collections/${encodeURIComponent(userDid)}?endpoint=${encodeURIComponent(endpoint)}`);
393393+ const collectionsResponse = await fetch(`${API_BASE_URL}/api/collections/${encodeURIComponent(userDid)}?endpoint=${encodeURIComponent(endpoint)}`);
391394392395 if (!collectionsResponse.ok) {
393396 throw new Error(`Error fetching collections: ${collectionsResponse.statusText}`);
···569572 // Process each selected collection sequentially
570573 for (const collection of selectedCollections) {
571574 try {
572572- // Use server-side API endpoint for fetching records
573573- const url = `/api/collections/${encodeURIComponent(did)}/records?endpoint=${encodeURIComponent(serviceEndpoint)}&collection=${encodeURIComponent(collection)}&limit=25`;
575575+ // Use server-side API endpoint for fetching records - Use absolute URL
576576+ const url = `${API_BASE_URL}/api/collections/${encodeURIComponent(did)}/records?endpoint=${encodeURIComponent(serviceEndpoint)}&collection=${encodeURIComponent(collection)}&limit=25`;
574577575578 const response = await fetch(url);
576579···700703 }
701704 };
702705703703- // Add a function to fetch debug info
706706+ // Add a function to fetch debug info - Use absolute API URL
704707 const fetchDebugInfo = async () => {
705708 try {
706706- const response = await fetch('/api/debug/session', {
707707- credentials: 'include'
709709+ const response = await fetch(`${API_BASE_URL}/api/debug/session`, { // Use absolute URL
710710+ credentials: 'include' // Keep credentials if needed for debug endpoint
708711 });
709712710713 if (!response.ok) {