You can access search results via JSON API by adding format=json
to your query:
https://codesearch.val.run/$2?q=fetch&page=18&format=json
For typeahead suggestions, use the /typeahead
endpoint:
https://codesearch.val.run/typeahead?q=fetch
Returns an array of strings in format "username" or "username/projectName"
Found 14173 results for "fetch"(1450ms)
318};
319320// Function to fetch the detailed report
321const fetchDetailedReport = async () => {
322setDetailedReport(null); // Clear previous detailed data while fetching
323try {
324const response = await fetch("/generate-report"); // Assuming this endpoint provides detailed data
325const data = await response.json();
326setDetailedReport(data);
327} catch (error) {
328console.error("Failed to fetch detailed report:", error);
329showCustomAlert("Failed to fetch detailed report."); // Use custom alert
330}
331};
332333// Function to fetch the weekly summary report with custom days
334const fetchWeeklySummary = async (days = 7) => {
335setWeeklySummary(null); // Clear previous summary data while fetching
336try {
337// This fetches the summary data for the specified number of days for all users
338const response = await fetch(`/generate-weekly-summary?days=${days}`);
339const data = await response.json();
340setWeeklySummary(data);
341} catch (error) {
342console.error("Failed to fetch weekly summary:", error);
343showCustomAlert("Failed to fetch weekly summary."); // Use custom alert
344}
345};
346347// Effect to fetch data when the view changes or component mounts
348useEffect(() => {
349// Fetch data for the current view
350if (currentView === "detailed") {
351fetchDetailedReport();
352} else if (currentView === "summary") {
353fetchWeeklySummary(daysToShow);
354}
355// Reset pagination and filters when changing tabs
377}
378setDaysToShow(days);
379// No need to call fetchWeeklySummary here - it will be triggered by the effect
380};
381
53);
54}
55const resp = await fetch(new URL(url.pathname, "https://esm.town").toString(), {
56method: req.method,
57headers: req.headers,