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=367&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 7895 results for "fetch"(1279ms)

healthCheckmain.tsx2 matches

@toowired•Updated 3 months ago
7
8 useEffect(() => {
9 fetch(window.location.href)
10 .then(response => response.json())
11 .then(data => setHealth(data))
12 .catch(error => console.error('Error fetching health data:', error));
13 }, []);
14

EquityCalculatormain.tsx12 matches

@bheemanadam•Updated 3 months ago
60// Enhanced Stock Data Service using a proxy approach
61const StockDataService = {
62 async fetchStockData(ticker) {
63 try {
64 // Use a proxy service to fetch stock data
65 const response = await fetch(`https://query1.finance.yahoo.com/v8/finance/chart/${ticker}`);
66
67 if (!response.ok) {
68 throw new Error("Failed to fetch stock data");
69 }
70
72 const stockInfo = data.chart.result[0];
73
74 // Fetch additional details
75 const summaryResponse = await fetch(
76 `https://query2.finance.yahoo.com/v10/finance/quoteSummary/${ticker}?modules=summaryDetail`,
77 );
84 };
85 } catch (error) {
86 console.error("Stock data fetch error:", error);
87
88 // Fallback mock data
128 };
129
130 // Fetch stock data when ticker changes
131 useEffect(() => {
132 const fetchStockData = async () => {
133 if (!stockTicker) return;
134
137
138 try {
139 const stockData = await StockDataService.fetchStockData(stockTicker);
140
141 if (stockData) {
144 }
145 } catch (err) {
146 setError(err.message || "Could not fetch stock data. Please check the ticker.");
147 setSharePrice("");
148 setAnnualDividendPerShare("");
152 };
153
154 fetchStockData();
155 }, [stockTicker]);
156

supremeSalmonLizardmain.tsx2 matches

@georgewitteman•Updated 3 months ago
14 start = performance.now();
15 try {
16 const res = await fetch(url);
17 end = performance.now();
18 status = res.status;
25 } catch (e) {
26 end = performance.now();
27 reason = `couldn't fetch: ${e}`;
28 ok = false;
29 console.log(`Website down (${url}): ${reason} (${end - start}ms)`);

uptimemain.tsx2 matches

@jjacobs22•Updated 3 months ago
11 const start = performance.now();
12 try {
13 const res = await fetch(url);
14 end = performance.now();
15 status = res.status;
22 } catch (e) {
23 end = performance.now();
24 reason = `couldn't fetch: ${e}`;
25 ok = false;
26 console.log(`Website down (${url}): ${reason} (${end - start}ms)`);

earthquakesmain.tsx3 matches

@fil•Updated 3 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import { set } from "https://esm.town/v/std/set?v=11";
3let { earthquakes_storage } = await import("https://esm.town/v/fil/earthquakes_storage");
12 import("https://cdn.jsdelivr.net/npm/linkedom@0.15/+esm").then((l) => l.parseHTML("<a>")),
13 import("https://cdn.jsdelivr.net/npm/topojson@3/+esm"),
14 fetch(dataUrl).then((r) => r.json()),
15 fetch(worldUrl).then((r) => r.json()),
16 ]);
17 world = topojson.presimplify(world, topojson.sphericalTriangleArea);

crmtemplatemain.tsx20 matches

@juecd•Updated 3 months ago
10 e.preventDefault();
11 try {
12 const response = await fetch("/login", {
13 method: "POST",
14 headers: { "Content-Type": "application/json" },
58 const [tagInput, setTagInput] = useState("");
59
60 // Fetch previous customer details when email changes
61 useEffect(() => {
62 const fetchCustomerDetails = async () => {
63 if (!email) return;
64
65 try {
66 const response = await fetch(`/get-customer-details?email=${encodeURIComponent(email)}`);
67 if (response.ok) {
68 const customerDetails = await response.json();
73 }
74 } catch (error) {
75 console.error("Error fetching customer details:", error);
76 }
77 };
78
79 fetchCustomerDetails();
80 }, [email]);
81
138 e.preventDefault();
139 try {
140 const response = await fetch("/add-interaction", {
141 method: "POST",
142 headers: { "Content-Type": "application/json" },
250 const [uniqueCustomerCount, setUniqueCustomerCount] = useState(0);
251
252 const fetchUniqueCustomerCount = async () => {
253 try {
254 const response = await fetch("/get-unique-customer-count");
255 const data = await response.json();
256 setUniqueCustomerCount(data.count);
257 } catch (error) {
258 console.error("Error fetching unique customer count:", error);
259 }
260 };
261
262 useEffect(() => {
263 fetchInteractions();
264 fetchUniqueCustomerCount();
265 }, [currentPage, selectedTags]);
266
281 const handleDeleteInteraction = async (id) => {
282 try {
283 const response = await fetch("/delete-interaction", {
284 method: "DELETE",
285 headers: { "Content-Type": "application/json" },
288
289 if (response.ok) {
290 fetchInteractions();
291 }
292 } catch (error) {
303 };
304
305 const fetchInteractions = async () => {
306 try {
307 const response = await fetch(`/get-interactions?page=${currentPage}`);
308 const data = await response.json();
309
336 if (selectedTags.length > 0) {
337 // Need to get total count of filtered interactions from server
338 const filteredCountResponse = await fetch(`/get-filtered-count?tags=${selectedTags.join(",")}`);
339 const filteredCountData = await filteredCountResponse.json();
340 setTotalInteractions(filteredCountData.count);
343 }
344 } catch (error) {
345 console.error("Error fetching interactions:", error);
346 }
347 };
348
349 useEffect(() => {
350 fetchInteractions();
351 }, [currentPage, selectedTags]);
352
481 const checkAuth = async () => {
482 try {
483 const response = await fetch("/check-auth");
484 const data = await response.json();
485 setIsAuthenticated(data.authenticated);

crmtemplatemain.tsx20 matches

@stevekrouse•Updated 3 months ago
10 e.preventDefault();
11 try {
12 const response = await fetch("/login", {
13 method: "POST",
14 headers: { "Content-Type": "application/json" },
58 const [tagInput, setTagInput] = useState("");
59
60 // Fetch previous customer details when email changes
61 useEffect(() => {
62 const fetchCustomerDetails = async () => {
63 if (!email) return;
64
65 try {
66 const response = await fetch(`/get-customer-details?email=${encodeURIComponent(email)}`);
67 if (response.ok) {
68 const customerDetails = await response.json();
73 }
74 } catch (error) {
75 console.error("Error fetching customer details:", error);
76 }
77 };
78
79 fetchCustomerDetails();
80 }, [email]);
81
138 e.preventDefault();
139 try {
140 const response = await fetch("/add-interaction", {
141 method: "POST",
142 headers: { "Content-Type": "application/json" },
250 const [uniqueCustomerCount, setUniqueCustomerCount] = useState(0);
251
252 const fetchUniqueCustomerCount = async () => {
253 try {
254 const response = await fetch("/get-unique-customer-count");
255 const data = await response.json();
256 setUniqueCustomerCount(data.count);
257 } catch (error) {
258 console.error("Error fetching unique customer count:", error);
259 }
260 };
261
262 useEffect(() => {
263 fetchInteractions();
264 fetchUniqueCustomerCount();
265 }, [currentPage, selectedTags]);
266
281 const handleDeleteInteraction = async (id) => {
282 try {
283 const response = await fetch("/delete-interaction", {
284 method: "DELETE",
285 headers: { "Content-Type": "application/json" },
288
289 if (response.ok) {
290 fetchInteractions();
291 }
292 } catch (error) {
303 };
304
305 const fetchInteractions = async () => {
306 try {
307 const response = await fetch(`/get-interactions?page=${currentPage}`);
308 const data = await response.json();
309
336 if (selectedTags.length > 0) {
337 // Need to get total count of filtered interactions from server
338 const filteredCountResponse = await fetch(`/get-filtered-count?tags=${selectedTags.join(",")}`);
339 const filteredCountData = await filteredCountResponse.json();
340 setTotalInteractions(filteredCountData.count);
343 }
344 } catch (error) {
345 console.error("Error fetching interactions:", error);
346 }
347 };
348
349 useEffect(() => {
350 fetchInteractions();
351 }, [currentPage, selectedTags]);
352
481 const checkAuth = async () => {
482 try {
483 const response = await fetch("/check-auth");
484 const data = await response.json();
485 setIsAuthenticated(data.authenticated);

CRMmain.tsx20 matches

@stevekrouse•Updated 3 months ago
10 e.preventDefault();
11 try {
12 const response = await fetch("/login", {
13 method: "POST",
14 headers: { "Content-Type": "application/json" },
58 const [tagInput, setTagInput] = useState("");
59
60 // Fetch previous customer details when email changes
61 useEffect(() => {
62 const fetchCustomerDetails = async () => {
63 if (!email) return;
64
65 try {
66 const response = await fetch(`/get-customer-details?email=${encodeURIComponent(email)}`);
67 if (response.ok) {
68 const customerDetails = await response.json();
73 }
74 } catch (error) {
75 console.error("Error fetching customer details:", error);
76 }
77 };
78
79 fetchCustomerDetails();
80 }, [email]);
81
138 e.preventDefault();
139 try {
140 const response = await fetch("/add-interaction", {
141 method: "POST",
142 headers: { "Content-Type": "application/json" },
250 const [uniqueCustomerCount, setUniqueCustomerCount] = useState(0);
251
252 const fetchUniqueCustomerCount = async () => {
253 try {
254 const response = await fetch("/get-unique-customer-count");
255 const data = await response.json();
256 setUniqueCustomerCount(data.count);
257 } catch (error) {
258 console.error("Error fetching unique customer count:", error);
259 }
260 };
261
262 useEffect(() => {
263 fetchInteractions();
264 fetchUniqueCustomerCount();
265 }, [currentPage, selectedTags]);
266
281 const handleDeleteInteraction = async (id) => {
282 try {
283 const response = await fetch("/delete-interaction", {
284 method: "DELETE",
285 headers: { "Content-Type": "application/json" },
288
289 if (response.ok) {
290 fetchInteractions();
291 }
292 } catch (error) {
303 };
304
305 const fetchInteractions = async () => {
306 try {
307 const response = await fetch(`/get-interactions?page=${currentPage}`);
308 const data = await response.json();
309
336 if (selectedTags.length > 0) {
337 // Need to get total count of filtered interactions from server
338 const filteredCountResponse = await fetch(`/get-filtered-count?tags=${selectedTags.join(",")}`);
339 const filteredCountData = await filteredCountResponse.json();
340 setTotalInteractions(filteredCountData.count);
343 }
344 } catch (error) {
345 console.error("Error fetching interactions:", error);
346 }
347 };
348
349 useEffect(() => {
350 fetchInteractions();
351 }, [currentPage, selectedTags]);
352
481 const checkAuth = async () => {
482 try {
483 const response = await fetch("/check-auth");
484 const data = await response.json();
485 setIsAuthenticated(data.authenticated);

CRMmain.tsx20 matches

@stevekrouse•Updated 3 months ago
10 e.preventDefault();
11 try {
12 const response = await fetch("/login", {
13 method: "POST",
14 headers: { "Content-Type": "application/json" },
58 const [tagInput, setTagInput] = useState("");
59
60 // Fetch previous customer details when email changes
61 useEffect(() => {
62 const fetchCustomerDetails = async () => {
63 if (!email) return;
64
65 try {
66 const response = await fetch(`/get-customer-details?email=${encodeURIComponent(email)}`);
67 if (response.ok) {
68 const customerDetails = await response.json();
73 }
74 } catch (error) {
75 console.error("Error fetching customer details:", error);
76 }
77 };
78
79 fetchCustomerDetails();
80 }, [email]);
81
138 e.preventDefault();
139 try {
140 const response = await fetch("/add-interaction", {
141 method: "POST",
142 headers: { "Content-Type": "application/json" },
250 const [uniqueCustomerCount, setUniqueCustomerCount] = useState(0);
251
252 const fetchUniqueCustomerCount = async () => {
253 try {
254 const response = await fetch("/get-unique-customer-count");
255 const data = await response.json();
256 setUniqueCustomerCount(data.count);
257 } catch (error) {
258 console.error("Error fetching unique customer count:", error);
259 }
260 };
261
262 useEffect(() => {
263 fetchInteractions();
264 fetchUniqueCustomerCount();
265 }, [currentPage, selectedTags]);
266
281 const handleDeleteInteraction = async (id) => {
282 try {
283 const response = await fetch("/delete-interaction", {
284 method: "DELETE",
285 headers: { "Content-Type": "application/json" },
288
289 if (response.ok) {
290 fetchInteractions();
291 }
292 } catch (error) {
303 };
304
305 const fetchInteractions = async () => {
306 try {
307 const response = await fetch(`/get-interactions?page=${currentPage}`);
308 const data = await response.json();
309
336 if (selectedTags.length > 0) {
337 // Need to get total count of filtered interactions from server
338 const filteredCountResponse = await fetch(`/get-filtered-count?tags=${selectedTags.join(",")}`);
339 const filteredCountData = await filteredCountResponse.json();
340 setTotalInteractions(filteredCountData.count);
343 }
344 } catch (error) {
345 console.error("Error fetching interactions:", error);
346 }
347 };
348
349 useEffect(() => {
350 fetchInteractions();
351 }, [currentPage, selectedTags]);
352
481 const checkAuth = async () => {
482 try {
483 const response = await fetch("/check-auth");
484 const data = await response.json();
485 setIsAuthenticated(data.authenticated);

TodoListmain.tsx9 matches

@vyatka•Updated 3 months ago
40
41 useEffect(() => {
42 fetchTasks();
43 loadUserPreferences();
44 }, []);
72 }
73
74 async function fetchTasks() {
75 try {
76 const response = await fetch("/get-tasks");
77 const data = await response.json();
78 setTaskLists(data);
79 } catch (error) {
80 console.error("Error fetching tasks", error);
81 }
82 }
86
87 try {
88 const response = await fetch("/add-task", {
89 method: "POST",
90 headers: { "Content-Type": "application/json" },
107
108 try {
109 const response = await fetch("/move-task", {
110 method: "POST",
111 headers: { "Content-Type": "application/json" },
125 async function removeTask(taskId, column) {
126 try {
127 const response = await fetch("/delete-task", {
128 method: "POST",
129 headers: { "Content-Type": "application/json" },
142
143 try {
144 const response = await fetch("/move-task", {
145 method: "POST",
146 headers: { "Content-Type": "application/json" },
174 if (!editedTaskText.trim() || !taskBeingEdited) return;
175 try {
176 const response = await fetch("/update-task", {
177 method: "POST",
178 headers: { "Content-Type": "application/json" },

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago