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/?q=fetch&page=103&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 8540 results for "fetch"(539ms)

ObawalLearningHUBmain.tsx2 matches

@obawal•Updated 2 weeks ago
43 setError(null);
44 try {
45 const response = await fetch("/auth/google", { method: "POST" });
46 if (!response.ok) {
47 throw new Error("Authentication failed");
72 const handleLogout = async () => {
73 try {
74 await fetch("/auth/logout", { method: "POST" });
75 setUser(null);
76 localStorage.removeItem("obawal_user");

NaijaHandleFindermain.tsx12 matches

@StanleyAkegbeotu•Updated 2 weeks ago
25 setIsUsernameModalOpen(true);
26 }
27 fetchJobs();
28 fetchChatMessages();
29 }, []);
30
31 const fetchJobs = async () => {
32 try {
33 const response = await fetch('/jobs');
34 const data = await response.json();
35 setJobs(data);
36 } catch (error) {
37 console.error('Error fetching jobs:', error);
38 }
39 };
40
41 const fetchChatMessages = async () => {
42 try {
43 const response = await fetch('/chat');
44 const data = await response.json();
45 setChatMessages(data);
46 } catch (error) {
47 console.error('Error fetching chat messages:', error);
48 }
49 };
67 }
68 try {
69 const response = await fetch('/jobs', {
70 method: 'POST',
71 headers: { 'Content-Type': 'application/json' },
73 });
74 if (response.ok) {
75 fetchJobs();
76 setNewJob({ title: '', company: '', description: '', location: '', salary: '' });
77 }
88 }
89 try {
90 const response = await fetch('/chat', {
91 method: 'POST',
92 headers: { 'Content-Type': 'application/json' },
94 });
95 if (response.ok) {
96 fetchChatMessages();
97 setNewMessage('');
98 }

Voice_Remindermain.tsx7 matches

@Scolly•Updated 2 weeks ago
12
13 useEffect(() => {
14 // Fetch existing reminders on component mount
15 const fetchReminders = async () => {
16 try {
17 const response = await fetch('/list-reminders');
18 if (!response.ok) {
19 throw new Error('Failed to fetch reminders');
20 }
21 const data = await response.json();
32 };
33
34 fetchReminders();
35 }, []);
36
72 formData.append('reminderDate', parsedDate.toISOString());
73
74 const response = await fetch('/save-reminder', {
75 method: 'POST',
76 body: formData
250 : null;
251 } catch (error) {
252 console.error(`Error fetching reminder ${key}:`, error);
253 return null;
254 }

Flashcard_Generatormain.tsx1 match

@dev_me•Updated 2 weeks ago
21 const generateFlashcards = async () => {
22 try {
23 const response = await fetch('/generate-flashcards', {
24 method: 'POST',
25 body: JSON.stringify({ content }),

sbirmain.tsx16 matches

@salon•Updated 2 weeks ago
42 current_status?: string | null;
43 solicitation_topics?: SolicitationTopic[];
44 fetch_error?: string;
45 id?: string;
46}
377 + " try {"
378 + " var apiUrl = window.location.pathname + '?action=analyze_sbir&format=json';"
379 + " var response = await fetch(apiUrl, {"
380 + " method: 'POST',"
381 + " headers: {"
517}
518
519async function fetchSBIRSolicitations(
520 criteria: SBIRSearchCriteria,
521 log: LogFunction,
523 const MAX_ROWS = 10;
524 const BASE_URL = "https://api.www.sbir.gov/public/api/solicitations";
525 const logPrefix = "SBIR API Fetch";
526
527 log("[STEP] " + logPrefix + ": Building API request...");
544
545 const apiUrl = BASE_URL + "?" + params.toString();
546 log("[INFO] " + logPrefix + ": Fetching URL: " + apiUrl);
547
548 try {
549 const response = await fetch(apiUrl, {
550 method: "GET",
551 headers: {
627
628 log(
629 "[SUCCESS] " + logPrefix + ": Successfully fetched and processed " + validSolicitations.length
630 + " solicitations.",
631 );
632 return { solicitations: validSolicitations, rawCount: rawCount };
633 } catch (error) {
634 log("[CRITICAL ERROR] " + logPrefix + ": Unexpected error during fetch/processing: " + error.message);
635 console.error(logPrefix + " Unexpected Error:", error);
636 return { error: "Unexpected server error during SBIR API fetch: " + error.message };
637 }
638}
648
649 try {
650 log("[STEP] Fetching SBIR Solicitations from API...");
651 const fetchResult = await fetchSBIRSolicitations(criteria, log);
652
653 if (fetchResult.error) {
654 log("[ERROR] Failed to fetch solicitations from SBIR API: " + fetchResult.error);
655 return { error: "Failed to retrieve funding opportunities from SBIR.gov.", details: fetchResult.error };
656 }
657
658 solicitations = fetchResult.solicitations || [];
659
660 if (solicitations.length === 0) {
805 intermediate_results: {
806 userCriteria: criteria,
807 fetchedSolicitationsCount: solicitations.length,
808 analysisResults: analysisResults,
809 },

jobBoardWithChatAppmain.tsx19 matches

@Mrigbalode•Updated 2 weeks ago
50
51 try {
52 const response = await fetch('/post-job', {
53 method: 'POST',
54 headers: { 'Content-Type': 'application/json' },
130
131 try {
132 const response = await fetch('/send-message', {
133 method: 'POST',
134 headers: { 'Content-Type': 'application/json' },
146
147 useEffect(() => {
148 async function fetchMessages() {
149 try {
150 const response = await fetch('/get-messages');
151 const fetchedMessages = await response.json();
152 setMessages(fetchedMessages);
153 } catch (error) {
154 console.error('Error fetching messages:', error);
155 }
156 }
157 fetchMessages();
158 const interval = setInterval(fetchMessages, 5000);
159 return () => clearInterval(interval);
160 }, []);
193
194 useEffect(() => {
195 async function fetchJobs() {
196 try {
197 const response = await fetch('/get-jobs');
198 const fetchedJobs = await response.json();
199 setJobs(fetchedJobs);
200 } catch (error) {
201 console.error('Error fetching jobs:', error);
202 }
203 }
204 if (userName) {
205 fetchJobs();
206 }
207 }, [userName]);
310 });
311 } catch (error) {
312 console.error("Job fetching error:", error);
313 return new Response(`Job fetching error: ${error.message}`, { status: 500 });
314 }
315 }
326 });
327 } catch (error) {
328 console.error("Message fetching error:", error);
329 return new Response(`Message fetching error: ${error.message}`, { status: 500 });
330 }
331 }

weddingRSVPTOForevermain.tsx1 match

@Mrigbalode•Updated 2 weeks ago
55
56 try {
57 const response = await fetch('/submit-rsvp', {
58 method: 'POST',
59 headers: { 'Content-Type': 'application/json' },

umbrellaRemindermain.tsx2 matches

@benjaminoansah•Updated 2 weeks ago
1import { email } from "https://esm.town/v/std/email?v=9";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3import { nominatimSearch } from "https://esm.town/v/stevekrouse/nominatimSearch";
4import { weatherGovGrid } from "https://esm.town/v/stevekrouse/weatherGovGrid";
14 lon,
15 });
16 let { properties: { periods } } = await fetchJSON(
17 grid.forecastHourly,
18 );

weatherBotmain.tsx5 matches

@benjaminoansah•Updated 2 weeks ago
1import { latLngOfCity } from "https://esm.town/v/jdan/latLngOfCity";
2import { fetchWebpage } from "https://esm.town/v/jdan/fetchWebpage";
3import { weatherOfLatLon } from "https://esm.town/v/jdan/weatherOfLatLon";
4import { OpenAI } from "https://esm.town/v/std/openai?v=4";
59 call: weatherOfLatLon
60 },
61 "fetchWebpage": {
62 openAiTool: {
63 type: "function",
64 function: {
65 name: "fetchWebpage",
66 description: "Fetch the weather forecast from the contents of a forecast URL",
67 parameters: {
68 type: "object",
78 }
79 },
80 call: fetchWebpage
81 }
82};

statusmonitor2 matches

@aboelezz•Updated 2 weeks ago
15 const start = performance.now();
16 try {
17 res = await fetch(url);
18 end = performance.now();
19 status = res.status;
25 } catch (e) {
26 end = performance.now();
27 reason = `couldn't fetch: ${e}`;
28 ok = false;
29 }

fetchPaginatedData2 file matches

@nbbaier•Updated 2 weeks ago

FetchBasic1 file match

@fredmoon•Updated 2 weeks ago