shitty-leaderboardindex.ts10 matches
41}, []);
4243// Fetch leaderboard data
44const fetchLeaderboard = async () => {
45if (!instanceId) return;
4648setIsLoading(true);
49
50// Fetch chores and history in parallel with cache-busting
51const timestamp = Date.now();
52const [choresResponse, historyResponse] = await Promise.all([
53fetch(`/api/${instanceId}/chores?_t=${timestamp}`),
54fetch(`/api/${instanceId}/history?_t=${timestamp}`),
55]);
5657if (!choresResponse.ok || !historyResponse.ok) {
58throw new Error("Failed to fetch data");
59}
60126setIsLoading(false);
127} catch (err) {
128console.error("Error fetching leaderboard:", err);
129setError("Failed to load leaderboard data");
130setIsLoading(false);
132};
133134// Initial fetch and polling
135useEffect(() => {
136if (!instanceId) return;
137138fetchLeaderboard();
139140// Poll every 30 seconds for real-time updates
141const interval = setInterval(fetchLeaderboard, 30000);
142143return () => clearInterval(interval);
send-transcriptsmain.tsx1 match
176});
177178export default app.fetch;
176}
177178console.log(`Fetching fresh data from OpenAI for: "${plantName}"`);
179// If not cached, fetch from OpenAI
180const prompt =
181`Please provide detailed information about the plant "${plantName}" in the following JSON format. Be specific and accurate:
261}
262} catch (error) {
263console.error("Error fetching plant information:", error);
264return c.json({
265error: "Failed to fetch plant information",
266details: error instanceof Error ? error.message : "Unknown error",
267}, 500);
390});
391392export default app.fetch; // This is the entry point for HTTP vals
orbiterHealthmonitor3 matches
10async function notifySlack(message: string) {
11try {
12await fetch(WEBHOOK_URL, {
13method: "POST",
14headers: {
29const start = performance.now();
30try {
31const res = await fetch(url);
32end = performance.now();
33status = res.status;
40} catch (e) {
41end = performance.now();
42reason = `couldn't fetch: ${e}`;
43ok = false;
44console.log(`Website down (${url}): ${reason} (${end - start}ms)`);
57});
5859export default instrument(app, { libraryDebugMode: true }).fetch;
60
sapo-mag-filmes-em-cartazmain.tsx2 matches
5export default async (req?: Request) => {
6const url = "https://mag.sapo.pt/filmes/no-cinema";
7const r = await fetch(url);
8if (!r.ok)
9return new Response("Failed to fetch data", { status: 502 });
1011const text = await r.text();
HelloWorld2server.tsx1 match
6.get("/foo", (c) => c.text("hello", 200));
78export default app.fetch;
328currentAnalysisSession.docSource = \`File: \${currentAnalysisSession.docName}\`;
329currentAnalysisSession.step = 2;
330fetchAndPopulateSuggestions();
331}
332
420
421if (suggestionsError) {
422document.getElementById('retry-suggestions-btn').addEventListener('click', fetchAndPopulateSuggestions);
423}
424
479const formData = new FormData();
480formData.append('documentFile', file, file.name);
481const res = await fetch(window.location.pathname + '?action=suggestTasks&format=json', { method: 'POST', body: formData });
482const data = await res.json().catch(() => { throw new Error(\`Server error: \${res.status}. Invalid JSON.\`); });
483if (!res.ok || data.error) throw new Error(data.error || \`Server error: \${res.status}\`);
500}
501502async function fetchAndPopulateSuggestions() {
503currentAnalysisSession.isProcessing = true;
504currentAnalysisSession.suggestionsError = null;
508const formData = new FormData();
509formData.append('documentText', currentAnalysisSession.docText.substring(0, 10000));
510const res = await fetch(window.location.pathname + '?action=suggestTasks&format=json', { method: 'POST', body: formData });
511const data = await res.json().catch(() => { throw new Error(\`Server returned non-JSON: \${res.status}\`); });
512if (!res.ok || data.error) throw new Error(data.error || \`Server Error: \${res.status}\`);
654formData.append('inputSourceDescription', currentAnalysisSession.docSource);
655656const res = await fetch(window.location.pathname + '?format=json', { method: 'POST', body: formData });
657const data = await res.json().catch(() => { throw new Error(\`Server error: \${res.status}. Invalid JSON.\`); });
658if (!res.ok || data.error) throw new Error(JSON.stringify(data.error || data.details) || \`Server error: \${res.status}\`);
Synthesizemain.tsx2 matches
72});
7374// Export the Hono app's fetch handler, which is the standard for Val Town HTTP endpoints
75export default app.fetch;
Townietext-editor.ts1 match
166let type_: "file" | "http" | "script";
167if (path.includes("backend/index.ts")) type_ = "http";
168if (file_text?.includes("export default app.fetch")) type_ = "http";
169if ([".ts", ".tsx", ".js", ".jsx"].some(ext => path.endsWith(ext))) {
170type_ = "script";