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=417&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 8238 results for "fetch"(1461ms)

searchWithSerpApimain.tsx1 match

@charmaine•Updated 3 months ago
24
25 try {
26 const response = await fetch(url);
27 if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
28

tenaciousCoffeeSpoonbillmain.tsx28 matches

@devansh_bansal•Updated 3 months ago
19 e.preventDefault();
20 try {
21 const response = await fetch("/register", {
22 method: "POST",
23 headers: { "Content-Type": "application/json" },
48 setCurrentUser({ username: "admin", fullName: "Admin" });
49 setView("admin-dashboard");
50 await fetchUserRegistrationList();
51 await fetchDateWiseAttendance(selectedDate);
52 return;
53 }
54
55 try {
56 const response = await fetch("/login", {
57 method: "POST",
58 headers: { "Content-Type": "application/json" },
63 setCurrentUser(result.user);
64 setView("attendance");
65 await fetchAttendanceList();
66 await fetchMonthlyStats();
67 } else {
68 alert(result.message);
75 const markAttendance = async (status) => {
76 try {
77 const response = await fetch("/mark-attendance", {
78 method: "POST",
79 headers: { "Content-Type": "application/json" },
87 const result = await response.json();
88 if (result.success) {
89 await fetchAttendanceList();
90 await fetchMonthlyStats();
91 alert(`Attendance marked as ${status}`);
92 } else {
98 };
99
100 const fetchAttendanceList = async () => {
101 try {
102 const response = await fetch("/attendance-list");
103 const list = await response.json();
104 setAttendanceList(list);
105 } catch (error) {
106 console.error("Failed to fetch attendance list");
107 }
108 };
109
110 const fetchMonthlyStats = async () => {
111 try {
112 const response = await fetch("/monthly-stats");
113 const stats = await response.json();
114 setMonthlyStats(stats);
115 } catch (error) {
116 console.error("Failed to fetch monthly stats");
117 }
118 };
119
120 const fetchUserRegistrationList = async () => {
121 try {
122 const response = await fetch("/user-registration-list");
123 const list = await response.json();
124 setUserRegistrationList(list);
125 } catch (error) {
126 console.error("Failed to fetch user registration list");
127 }
128 };
129
130 const fetchDateWiseAttendance = async (date) => {
131 try {
132 const response = await fetch(`/date-wise-attendance?date=${date}`);
133 const list = await response.json();
134 setDateWiseAttendance(list);
135 } catch (error) {
136 console.error("Failed to fetch date-wise attendance");
137 }
138 };
140 const deleteUser = async (username) => {
141 try {
142 const response = await fetch("/delete-user", {
143 method: "POST",
144 headers: { "Content-Type": "application/json" },
147 const result = await response.json();
148 if (result.success) {
149 await fetchUserRegistrationList();
150 alert("User deleted successfully");
151 } else {
232 onChange={(e) => {
233 setSelectedDate(e.target.value);
234 fetchDateWiseAttendance(e.target.value);
235 }}
236 style={{ marginBottom: "15px" }}
540 }
541
542 // Fetch User Registration List
543 if (request.url.includes("/user-registration-list")) {
544 const result = await sqlite.execute(
554 }
555
556 // Fetch Date-wise Attendance
557 if (request.url.includes("/date-wise-attendance")) {
558 const url = new URL(request.url);
572 }
573
574 // Fetch Monthly Stats
575 if (request.url.includes("/monthly-stats")) {
576 const currentDate = new Date();
609 }
610
611 // Fetch Attendance List
612 if (request.url.includes("/attendance-list")) {
613 const result = await sqlite.execute(

spotifyAPImain.tsx2 matches

@alexwein•Updated 3 months ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export let spotifyAPI = ({token, endpoint, ...params}) => fetchJSON(
4 `https://api.spotify.com/v1/${endpoint}?${new URLSearchParams(params)}`,
5 {

cerebras_codermain.tsx1 match

@abuhasan786•Updated 3 months ago
182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({

photoEditingAIAppmain.tsx2 matches

@roysarajit143•Updated 3 months ago
23 const formData = new FormData();
24 formData.append('image', file);
25 const response = await fetch('/upload', {
26 method: 'POST',
27 body: formData
32
33 const generateAIImage = async (prompt) => {
34 const response = await fetch('/generate', {
35 method: 'POST',
36 headers: { 'Content-Type': 'application/json' },

originalTomatoLynxmain.tsx1 match

@jonatan711•Updated 3 months ago
182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({

cerebras_codermain.tsx1 match

@jonatan711•Updated 3 months ago
182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({

reactPinterestClonemain.tsx9 matches

@Ronu12_05•Updated 3 months ago
116
117 useEffect(() => {
118 async function fetchPosts() {
119 try {
120 const response = await fetch('/get-posts');
121 if (!response.ok) {
122 throw new Error('Failed to fetch posts');
123 }
124 const fetchedPosts = await response.json();
125 setPosts(fetchedPosts);
126 } catch (error) {
127 setError(error.message);
128 console.error('Failed to fetch posts', error);
129 }
130 }
131 fetchPosts();
132 }, []);
133
134 const handlePostSubmit = async (newPost) => {
135 try {
136 const response = await fetch('/create-post', {
137 method: 'POST',
138 headers: { 'Content-Type': 'application/json' },
154 const handleDeletePost = async (postId) => {
155 try {
156 const response = await fetch(`/delete-post/${postId}`, { method: 'DELETE' });
157
158 if (!response.ok) {

audioManagermain.tsx3 matches

@Foji•Updated 3 months ago
1
2import { OpenAI } from "https://esm.town/v/yawnxyz/OpenAI";
3import { fetch } from "https://esm.town/v/std/fetch";
4
5import { getUrl } from "https://esm.town/v/yawnxyz/download";
180
181
182 // Function to fetch audio data and return as ArrayBuffer
183 async getAudioBuffer(url) {
184 const response = await fetch(url);
185 return await response.arrayBuffer();
186 }

filemain.tsx3 matches

@loading•Updated 3 months ago
149
150 const generateQRCode = async (id: string) => {
151 const qrcode = await (await fetch(`https://loading-generateqr.web.val.run/?peer=${id}`)).json();
152 setQrcode(qrcode.base64Image);
153 };
406});
407
408// self.addEventListener('fetch', (event) => {
409// event.respondWith(
410// caches.match(event.request).then((response) => {
411// return response || fetch(event.request);
412// })
413// );

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago