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=15&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 14071 results for "fetch"(3847ms)

tuempresaValidationCatalogGemini.tsx17 matches

@arequipe•Updated 1 day ago
1import { blob } from "https://esm.town/v/std/blob";
2import { fetch } from "https://esm.town/v/std/fetch";
3import { sqlite } from "https://esm.town/v/std/sqlite";
4
24 }
25
26 const fetchLinkedRecord = async (tableId: string, recordId: string) => {
27 const res = await fetch(`https://api.airtable.com/v0/${AIRTABLE_BASE_ID}/${tableId}/${recordId}`, {
28 headers: airtableHeaders,
29 });
31 const errorText = await res.text();
32 // El error de Airtable será capturado aquí con el mensaje específico
33 throw new Error(`Airtable fetch failed for ${tableId}/${recordId}: ${res.status} - ${errorText}`);
34 }
35 return (await res.json()).fields;
36 };
37
38 const fetchMultipleLinkedRecords = async (tableId: string, recordIds: string[]) => {
39 if (!recordIds || recordIds.length === 0) return [];
40 const records = await Promise.all(recordIds.map(id => fetchLinkedRecord(tableId, id)));
41 return records;
42 };
43
44 const updateAirtableFields = async (targetTable: string, targetRecordId: string, fields: Record<string, any>) => {
45 const res = await fetch(`https://api.airtable.com/v0/${AIRTABLE_BASE_ID}/${targetTable}/${targetRecordId}`, {
46 method: "PATCH",
47 headers: airtableHeaders,
66 console.log("Base de datos de catálogos SAT cargada.");
67
68 const viajeData = await fetchLinkedRecord(VIAJES_TABLE, recordId);
69
70 const emisorId = viajeData.Emisor?.[0];
81 const [emisor, clienteOrigen, clienteDestino, origen, destino, unidad, operador, remolque, bienes] = await Promise
82 .all([
83 emisorId ? fetchLinkedRecord(CLIENTES_TABLE, emisorId) : Promise.resolve(null),
84 clienteOrigenId ? fetchLinkedRecord(CLIENTES_TABLE, clienteOrigenId) : Promise.resolve(null),
85 clienteDestinoId ? fetchLinkedRecord(CLIENTES_TABLE, clienteDestinoId) : Promise.resolve(null),
86 origenId ? fetchLinkedRecord(UBICACIONES_TABLE, origenId) : Promise.resolve(null),
87 destinoId ? fetchLinkedRecord(UBICACIONES_TABLE, destinoId) : Promise.resolve(null),
88 unidadId ? fetchLinkedRecord(UNIDADES_TABLE, unidadId) : Promise.resolve(null),
89 operadorId ? fetchLinkedRecord(OPERADORES_TABLE, operadorId) : Promise.resolve(null),
90 remolqueId ? fetchLinkedRecord(REMOLQUES_TABLE, remolqueId) : Promise.resolve(null),
91 fetchMultipleLinkedRecords(BIENES_TABLE, bienesIds),
92 ]);
93

CheckExamplemain.tsx2 matches

@wolf•Updated 1 day ago
1let resp = await fetch("https://lsp-dev.val.town/auth", {
2 method: "POST",
3 headers: {
7});
8const cookie = resp.headers.get("set-cookie");
9resp = await fetch("https://lsp-dev.val.town/lsp/check", {
10 method: "POST",
11 headers: {

untitled-2430main.tsx1 match

@Rinku123•Updated 1 day ago
123. In JavaScript:
13 - Add an event listener to the “Get Quote” button.
14 - Send an HTTP request to a Python back end to fetch a new random quote each time the button is clicked.
15 - Update the quote box with the returned text.
16

html2svgmain.tsx1 match

@g•Updated 1 day ago
221app.get("/main.js", serve(js, "text/javascript"));
222
223export default app.fetch;

OptimismTrackerindex.ts1 match

@dcm31•Updated 1 day ago
34});
35
36export default app.fetch;

FarcasterSpacesSpace.tsx7 matches

@moe•Updated 1 day ago
7
8import { Button, Input, Section, ShareButton, Sheet } from '../components/ui.tsx'
9import { fetchUsersById } from '../util/neynar.ts'
10import { supabase, fetchSpace } from '../util/supabase.ts'
11
12import {
44 const { id } = useParams()
45
46 const { data: space, isLoading } = useQuery({ queryKey: ['space', id], queryFn: () => fetchSpace(id) })
47
48 const [calling, setCalling] = useState(false)
139
140 const queryFn = () =>
141 fetch(`/api/channels`)
142 .then((r) => r.json())
143 .then((r) => r?.data?.channels?.find((c) => c.channel_name == channel))
146
147 const join = async () => {
148 const response = await fetch(`/api/token?channel=${channel}&uid=${uid}`).then((r) => r.json())
149 console.log('response', response)
150 setToken(response.token)
408 if (!uid) return null
409 if (uid > 2_000_000) return null
410 return await fetchUsersById(`${uid}`).then((users) => users?.[0])
411}
412
439
440 useEffect(() => {
441 fetchSpace(id).then(setSpace)
442
443 const changes = supabase

FarcasterSpacesindex.tsx4 matches

@moe•Updated 1 day ago
7import { embedMetadata, handleFarcasterEndpoints, name } from './farcaster.ts'
8import { handleImageEndpoints } from './image.tsx'
9import { fetchNeynarGet } from './neynar.ts'
10
11const app = new Hono()
28 const url = new URL(c.req.url)
29 const path = url.searchParams.get('path')
30 const response = await fetchNeynarGet(path)
31 return c.json(response)
32})
73})
74
75// HTTP vals expect an exported "fetch handler"
76// This is how you "run the server" in Val Town with Hono
77export default app.fetch
78

FarcasterSpacesimage.tsx6 matches

@moe•Updated 1 day ago
5import satori from 'npm:satori'
6
7import { fetchSpace } from '../frontend/util/supabase.ts'
8import { fetchUsersById } from './neynar.ts'
9
10export function handleImageEndpoints(app: Hono) {
38
39export async function spaceImage(channel: string) {
40 const space = await fetchSpace(channel)
41 if (!space) return await homeImage()
42
43 const users = await fetchUsersById([space.created_by, ...space.hosts, ...space.speakers].join(','))
44
45 const hostFids = [space.created_by, ...space.hosts]
126 const fontPromises = fontsConfig.map(async (font) => {
127 const fontUrl = 'https://cdn.jsdelivr.net/npm/@tamagui/font-inter@1.108.3/otf/' + font.fontFile
128 const fontArrayBuf = await fetch(fontUrl).then((res) => res.arrayBuffer())
129 return { name: font.name, data: fontArrayBuf, weight: font.weight }
130 })
137 // const api = `https://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/svg/${code.toLowerCase()}.svg`
138 const api = `https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/${code.toLowerCase()}_color.svg`
139 return fetch(api).then((r) => r.text())
140}
141

FarcasterSpacesHome.tsx2 matches

@moe•Updated 1 day ago
7
8import { Button, Input, Section, ShareButton } from '../components/ui.tsx'
9import { fetchUsersById } from '../util/neynar.ts'
10import { supabase } from '../util/supabase.ts'
11
39function Spaces() {
40 const queryFn = async () => {
41 const agoraChannels = await fetch(`/api/channels`)
42 .then((r) => r.json())
43 .then((r) => r?.data?.channels)

FarcasterSpacesfarcaster-notifications.ts2 matches

@moe•Updated 1 day ago
44 const { data, error } = await supabase.from(table).select()
45 if (error) {
46 console.error('đź”” sendNotificationToAllUsers: error fetching users', error)
47 return
48 }
60
61async function sendNotification(notificationDetails: any, payload: any) {
62 return await fetch(notificationDetails.url, {
63 method: 'POST',
64 headers: { 'Content-Type': 'application/json' },

FetchBasic2 file matches

@ther•Updated 6 days ago

GithubPRFetcher

@andybak•Updated 1 week ago