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=482&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 8288 results for "fetch"(952ms)

prodigiousBrownImpalamain.tsx4 matches

@stevekrouse•Updated 4 months ago
36
37 useEffect(() => {
38 async function fetchStats() {
39 const response = await fetch("/dashboard-stats");
40 const data = await response.json();
41 setStats(data);
42 }
43 fetchStats();
44 }, []);
45
146
147 try {
148 const response = await fetch("/", {
149 method: "POST",
150 body: JSON.stringify({

BestTime2postmain.tsx1 match

@taurusismagic•Updated 4 months ago
60
61 try {
62 const response = await fetch("/check-email", {
63 method: "POST",
64 headers: { "Content-Type": "application/json" },

captivatingPurpleTapirmain.tsx20 matches

@mohsen•Updated 4 months ago
15
16 useEffect(() => {
17 fetchStocks();
18 fetchOperations();
19 }, []);
20
21 async function fetchStocks() {
22 const response = await fetch('/stocks');
23 const data = await response.json();
24 setStocks(data);
25 }
26
27 async function fetchOperations() {
28 const response = await fetch('/operations');
29 const data = await response.json();
30 setOperations(data);
33 async function addStock(e) {
34 e.preventDefault();
35 const response = await fetch('/stocks', {
36 method: 'POST',
37 headers: { 'Content-Type': 'application/json' },
38 body: JSON.stringify(newStock)
39 });
40 await fetchStocks();
41 await fetchOperations();
42 setNewStock({ symbol: '', shares: 0, purchasePrice: 0, sellPrice: 0 });
43 }
44
45 async function deleteStock(symbol: string, shares: number, purchasePrice: number) {
46 const response = await fetch('/stocks', {
47 method: 'DELETE',
48 headers: { 'Content-Type': 'application/json' },
49 body: JSON.stringify({ symbol, shares, purchasePrice })
50 });
51 await fetchStocks();
52 await fetchOperations();
53 }
54
55 async function updateStock(stock) {
56 const response = await fetch('/stocks', {
57 method: 'PUT',
58 headers: { 'Content-Type': 'application/json' },
59 body: JSON.stringify(stock)
60 });
61 await fetchStocks();
62 await fetchOperations();
63 setEditingStock(null);
64 }
178 stock.shares,
179 stock.purchasePrice,
180 await fetchStockPrice(stock.symbol),
181 stock.sellPrice || null
182 ]
269}
270
271// Existing fetchStockPrice function remains the same
272async function fetchStockPrice(symbol: string): Promise<number> {
273 try {
274 const response = await fetch(`https://query1.finance.yahoo.com/v8/finance/chart/${symbol}`);
275 const data = await response.json();
276 return data.chart.result[0].meta.regularMarketPrice;
277 } catch {
278 return 0; // Default to 0 if price can't be fetched
279 }
280}

SermonGPTUImain.tsx9 matches

@mjweaver01•Updated 4 months ago
91 const [autoScroll, setAutoScroll] = useState(true);
92
93 // Fetch saved sermons on component mount
94 useEffect(() => {
95 const fetchSermons = async () => {
96 try {
97 const response = await fetch(`${endpointURL}/sermons`);
98 const data = await response.json();
99 console.log("Fetched sermons:", data); // Debugging log
100 // Ensure data is an array, even if it's empty
101 setSermons(Array.isArray(data) ? data : []);
102 } catch (error) {
103 console.error("Failed to fetch sermons:", error);
104 // Set to empty array in case of error
105 setSermons([]);
107 };
108
109 fetchSermons();
110 }, []);
111
169
170 try {
171 const response = await fetch(`${endpointURL}/delete-sermon/${sermonId}`, {
172 method: "DELETE",
173 });
200
201 try {
202 const res = await fetch(`${endpointURL}/save-sermon`, {
203 method: "POST",
204 headers: {
233
234 try {
235 const res = await fetch(`${endpointURL}/stream`, {
236 method: "POST",
237 body: JSON.stringify({ question }),

legendaryVioletBovidmain.tsx4 matches

@stevekrouse•Updated 4 months ago
36
37 useEffect(() => {
38 async function fetchStats() {
39 const response = await fetch("/dashboard-stats");
40 const data = await response.json();
41 setStats(data);
42 }
43 fetchStats();
44 }, []);
45
146
147 try {
148 const response = await fetch("/", {
149 method: "POST",
150 body: JSON.stringify({

notionSiteRssmain.tsx4 matches

@bao•Updated 4 months ago
13
14 try {
15 // Fetch database metadata
16 const databaseMetadata = await notion.databases.retrieve({
17 database_id: databaseId,
18 });
19
20 // Fetch pages from the database
21 const response = await notion.databases.query({
22 database_id: databaseId,
24 property: "Published", // Customize based on your database schema
25 checkbox: {
26 equals: true, // Only fetch published pages
27 },
28 },
48 });
49 } catch (error) {
50 console.error("Error fetching Notion pages:", error);
51 return new Response("Error retrieving pages", { status: 500 });
52 }

tweetArchiveViewermain.tsx10 matches

@nulo•Updated 4 months ago
17const COBALT_API_URL = "https://dorsiblancoapicobalt.nulo.in";
18
19async function fetchMedia(url) {
20 try {
21 const response = await fetch(COBALT_API_URL, {
22 method: "POST",
23 headers: {
53 return data;
54 } catch (error) {
55 console.error("Error fetching media:", error);
56 return null;
57 }
58}
59
60async function fetchTweets(dumpFile) {
61 try {
62 const response = await fetch(BASE_URL + dumpFile);
63 if (!response.ok) {
64 throw new Error(`HTTP error! status: ${response.status}`);
91 return { tweets, totalProcessed };
92 } catch (error) {
93 console.error("Error fetching or parsing data:", error);
94 throw new Error("Error al cargar los tweets. Por favor, intentá de nuevo más tarde.");
95 }
134 const media = await Promise.all(tweet.mediaUrls.map(async (media) => {
135 if (media.type === "video") {
136 const fetchedMedia = await fetchMedia(media.url);
137 return fetchedMedia ? { ...media, fetchedUrl: fetchedMedia.url } : media;
138 }
139 return media;
171 <div key={index} className="video-container">
172 <video controls poster={media.preview} className="tweet-video" onLoadedMetadata={onMediaLoad}>
173 <source src={media.fetchedUrl || media.url} type="video/mp4" />
174 Your browser does not support the video tag.
175 </video>
235 setError(null);
236 try {
237 const { tweets: newTweets, totalProcessed: newTotalProcessed } = await fetchTweets(selectedDump.file);
238 setTweets(newTweets);
239 setFilteredTweets(newTweets);

valreadmegeneratormain.tsx1 match

@prashamtrivedi•Updated 4 months ago
42
43 try {
44 const response = await fetch(`/generate-readme/${user}/${val}`);
45
46 if (!response.ok) {

valreadmegeneratorREADME.md2 matches

@prashamtrivedi•Updated 4 months ago
29
302. **Generate:**
31 - Click on 'Generate README' and watch as the application swiftly fetches and processes the Val code to create a Markdown README.
32
333. **Copy and Share:**
42- **TailwindCSS:** For styling the application.
43- **Deno:** The server-side environment.
44- **ValTown SDK:** Integrated to fetch Val details.
45- **OpenAI GPT-4:** To generate natural language README content.
46- **JavaScript Modules (ESM):** For seamless module imports.

personalSocialCardGeneratormain.tsx1 match

@mumu•Updated 4 months ago
10 event.preventDefault();
11 const formData = new FormData(event.target);
12 const response = await fetch("/generate", {
13 method: "POST",
14 body: formData,

fetchPaginatedData2 file matches

@nbbaier•Updated 2 weeks ago

FetchBasic1 file match

@fredmoon•Updated 2 weeks ago