This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

fix api route

+12 -9
+12 -9
src/components/CollectionsFeed/CollectionsFeed.js
··· 9 9 import { Helmet } from 'react-helmet'; 10 10 import { useAuth } from '../../contexts/AuthContext'; 11 11 12 + // Define the backend API base URL 13 + const API_BASE_URL = 'https://api.cred.blue'; 14 + 12 15 const CollectionsFeed = () => { 13 16 const { username } = useParams(); 14 17 const navigate = useNavigate(); ··· 145 148 const maxPages = isInitialDeepLoad ? 1000 : 1; 146 149 147 150 while (hasMoreRecords && pageCount < maxPages && !reachedCutoff) { 148 - // Use our server-side API to fetch records 149 - let url = `/api/collections/${encodeURIComponent(userDid)}/records?endpoint=${encodeURIComponent(endpoint)}&collection=${encodeURIComponent(collection)}&limit=100`; 151 + // Use our server-side API to fetch records - Use absolute URL 152 + let url = `${API_BASE_URL}/api/collections/${encodeURIComponent(userDid)}/records?endpoint=${encodeURIComponent(endpoint)}&collection=${encodeURIComponent(collection)}&limit=100`; 150 153 151 154 // Add cursor if we have one 152 155 if (cursor) { ··· 385 388 // Continue without profile data, not critical 386 389 } 387 390 388 - // Use our server-side API to fetch collections 391 + // Use our server-side API to fetch collections - Use absolute URL 389 392 try { 390 - const collectionsResponse = await fetch(`/api/collections/${encodeURIComponent(userDid)}?endpoint=${encodeURIComponent(endpoint)}`); 393 + const collectionsResponse = await fetch(`${API_BASE_URL}/api/collections/${encodeURIComponent(userDid)}?endpoint=${encodeURIComponent(endpoint)}`); 391 394 392 395 if (!collectionsResponse.ok) { 393 396 throw new Error(`Error fetching collections: ${collectionsResponse.statusText}`); ··· 569 572 // Process each selected collection sequentially 570 573 for (const collection of selectedCollections) { 571 574 try { 572 - // Use server-side API endpoint for fetching records 573 - const url = `/api/collections/${encodeURIComponent(did)}/records?endpoint=${encodeURIComponent(serviceEndpoint)}&collection=${encodeURIComponent(collection)}&limit=25`; 575 + // Use server-side API endpoint for fetching records - Use absolute URL 576 + const url = `${API_BASE_URL}/api/collections/${encodeURIComponent(did)}/records?endpoint=${encodeURIComponent(serviceEndpoint)}&collection=${encodeURIComponent(collection)}&limit=25`; 574 577 575 578 const response = await fetch(url); 576 579 ··· 700 703 } 701 704 }; 702 705 703 - // Add a function to fetch debug info 706 + // Add a function to fetch debug info - Use absolute API URL 704 707 const fetchDebugInfo = async () => { 705 708 try { 706 - const response = await fetch('/api/debug/session', { 707 - credentials: 'include' 709 + const response = await fetch(`${API_BASE_URL}/api/debug/session`, { // Use absolute URL 710 + credentials: 'include' // Keep credentials if needed for debug endpoint 708 711 }); 709 712 710 713 if (!response.ok) {