Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/image-url.jpg%20%22Optional%20title%22?q=fetch&page=10&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 8302 results for "fetch"(649ms)

fetchText2 file matches

@mgruel•Updated 1 year ago

fetchPelotonData1 file match

@andreterron•Updated 1 year ago

fetchWithJSON1 file match

@yuler•Updated 1 year ago

fetchDOEMenu2 file matches

@tal•Updated 1 year ago

discordFetch2 file matches

@stevekrouse•Updated 1 year ago

fetchHeaders22 file matches

@stevekrouse•Updated 1 year ago

fetchHeaders21 file match

@mrahnis•Updated 1 year ago

fetchHtmlDom2 file matches

@aeaton•Updated 1 year ago

fetchReadwiseList1 file match

@ofalvai•Updated 1 year ago

fetchTable2 file matches

@stevekrouse•Updated 1 year ago

EEPMOnitoringweeklyReport.tsx24 matches

@solomonferede•Updated 16 mins ago
230 const [selectedAuthorName, setSelectedAuthorName] = useState("");
231
232 // Function to fetch the detailed report
233 const fetchDetailedReport = async () => {
234 // setWeeklySummary(null); // REMOVED: Don't clear summary when fetching detailed
235 setDetailedReport(null); // Clear previous detailed data while fetching
236 try {
237 const response = await fetch("/generate-report"); // Assuming this endpoint provides detailed data
238 const data = await response.json();
239 setDetailedReport(data);
240 } catch (error) {
241 console.error("Failed to fetch detailed report:", error);
242 alert("Failed to fetch detailed report.");
243 }
244 };
245
246 // Function to fetch the weekly summary report
247 const fetchWeeklySummary = async () => {
248 // setDetailedReport(null); // REMOVED: Don't clear detailed when fetching summary
249 setWeeklySummary(null); // Clear previous summary data while fetching
250 try {
251 // This fetches the summary data for the last 7 days for all users
252 // Assumes the /generate-weekly-summary endpoint exists on the server
253 const response = await fetch("/generate-weekly-summary");
254 const data = await response.json(); // Assuming data is an array like [{ author: 'User A', submittedArticles: 10, monitoredMedia: 5 }, ...]
255 setWeeklySummary(data);
256 } catch (error) {
257 console.error("Failed to fetch weekly summary:", error);
258 alert("Failed to fetch weekly summary.");
259 }
260 };
261
262 // Effect to fetch data when the view changes or component mounts
263 useEffect(() => {
264 // Fetch data for the current view
265 if (currentView === "detailed") {
266 // Only fetch detailed if it's not already loaded (optional optimization)
267 // if (!detailedReport) {
268 fetchDetailedReport();
269 // }
270 } else if (currentView === "summary") {
271 // Only fetch summary if it's not already loaded (optional optimization)
272 // if (!weeklySummary) {
273 fetchWeeklySummary();
274 // }
275 }
337 // so it should contain data if the detailed tab was visited or on initial load.
338 if (!detailedReport || !detailedReport.newsArticles || !detailedReport.mediaEntries) {
339 // This alert is still necessary if the initial fetch failed or hasn't completed yet
340 alert(
341 "Detailed report data is not available to show author details. Please try switching to the Detailed Report tab first.",
653 </>
654 )
655 : <p>Fetching detailed report...</p>} {/* Loading indicator */}
656 </>
657 )}
755 </>
756 )
757 : <p>Fetching weekly summary...</p>} {/* Loading indicator */}
758 </>
759 )}

EEPMOnitoringApp.tsx8 matches

@solomonferede•Updated 42 mins ago
42 const handleLogin = async (username, password) => {
43 try {
44 const response = await fetch("/login", {
45 method: "POST",
46 headers: { "Content-Type": "application/json" },
407 }
408
409 if (path === "/fetch-news" && method === "GET") {
410 const newsArticles = await sqlite.execute(`SELECT * FROM ${KEY}_news_articles ORDER BY created_at DESC`);
411 return new Response(JSON.stringify({ articles: newsArticles.rows }), {
414 }
415
416 if (path === "/fetch-media" && method === "GET") {
417 const mediaEntries = await sqlite.execute(`SELECT * FROM ${KEY}_media_monitoring ORDER BY created_at DESC`);
418 return new Response(JSON.stringify({ entries: mediaEntries.rows }), {
506
507 if (result.rowsAffected > 0) {
508 // Fetch the updated article to return it to the client
509 const updatedArticle = await sqlite.execute(`SELECT * FROM ${KEY}_news_articles WHERE id = ?`, [id]);
510
517 // This case should ideally not happen if rowsAffected > 0, but good for robustness
518 return new Response(
519 JSON.stringify({ success: false, message: "Article updated but could not be refetched" }),
520 {
521 status: 500, // Internal Server Error
568
569 if (result.rowsAffected > 0) {
570 // Fetch the updated entry to return it
571 const updatedEntry = await sqlite.execute(`SELECT * FROM ${KEY}_media_monitoring WHERE id = ?`, [id]);
572 return new Response(JSON.stringify({ success: true, entry: updatedEntry.rows[0] }), {
603 const sevenDaysAgoISO = sevenDaysAgo.toISOString(); // e.g., "2023-10-27T10:00:00.000Z"
604
605 // Fetch news article counts per author in the last 7 days
606 const newsCountsResult = await sqlite.execute(
607 `
614 );
615
616 // Fetch media monitoring counts per author in the last 7 days
617 const mediaCountsResult = await sqlite.execute(
618 `