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/image-url.jpg?q=fetch&page=194&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 11297 results for "fetch"(2761ms)

demogemini.ts1 match

@yuxiaoy•Updated 1 week ago
21
22 // Make request to Gemini API
23 const response = await fetch(`${GEMINI_API_URL}?key=${apiKey}`, {
24 method: "POST",
25 headers: {

demoindex.ts2 matches

@yuxiaoy•Updated 1 week ago
52
53 // Make request to Gemini API
54 const response = await fetch(`${GEMINI_API_URL}?key=${apiKey}`, {
55 method: "POST",
56 headers: {
218
219// Export the Hono app for HTTP val
220export default app.fetch;

AgriAiindex.ts2 matches

@morispolanco•Updated 1 week ago
52});
53
54// Export the fetch handler for HTTP vals
55export default app.fetch;

AgriAiUserDashboard.tsx18 matches

@morispolanco•Updated 1 week ago
25 }, [user.farms]);
26
27 // Fetch crop records when a farm is selected
28 useEffect(() => {
29 if (selectedFarm) {
30 fetchCropRecords(selectedFarm.id);
31 }
32 }, [selectedFarm]);
33
34 // Fetch pest/disease records when a crop is selected
35 useEffect(() => {
36 if (selectedCrop) {
37 fetchPestRecords(selectedCrop.id);
38 }
39 }, [selectedCrop]);
40
41 // Fetch crop records for a farm
42 const fetchCropRecords = async (farmId: number) => {
43 setIsLoading(true);
44 setError(null);
45
46 try {
47 const response = await fetch(`/api/users/${user.id}/farms/${farmId}/crops`);
48 const data = await response.json();
49
52 setSelectedCrop(data.data.length > 0 ? data.data[0] : null);
53 } else {
54 setError(data.error || "Error fetching crop records");
55 setCropRecords([]);
56 setSelectedCrop(null);
57 }
58 } catch (error) {
59 console.error("Error fetching crop records:", error);
60 setError("Error connecting to the server. Please try again.");
61 setCropRecords([]);
66 };
67
68 // Fetch pest/disease records for a crop
69 const fetchPestRecords = async (cropId: number) => {
70 setIsLoading(true);
71 setError(null);
72
73 try {
74 const response = await fetch(`/api/users/${user.id}/farms/${selectedFarm!.id}/crops/${cropId}/pests`);
75 const data = await response.json();
76
78 setPestRecords(data.data);
79 } else {
80 setError(data.error || "Error fetching pest/disease records");
81 setPestRecords([]);
82 }
83 } catch (error) {
84 console.error("Error fetching pest/disease records:", error);
85 setError("Error connecting to the server. Please try again.");
86 setPestRecords([]);
107
108 try {
109 const response = await fetch(`/api/users/${user.id}/farms`, {
110 method: "POST",
111 headers: {
125 if (data.success && data.data) {
126 // Refresh the user data to get the updated farms list
127 const userResponse = await fetch(`/api/users?email=${encodeURIComponent(user.email)}`);
128 const userData = await userResponse.json();
129
164
165 try {
166 const response = await fetch(`/api/users/${user.id}/farms/${selectedFarm!.id}/crops`, {
167 method: "POST",
168 headers: {
182 if (data.success && data.data) {
183 // Refresh the crop records
184 await fetchCropRecords(selectedFarm!.id);
185 setShowNewCropForm(false);
186 form.reset();

AgriAiApp.tsx9 matches

@morispolanco•Updated 1 week ago
33 const [cropType, setCropType] = useState<string>("");
34
35 // Fetch the pest/disease library on component mount
36 useEffect(() => {
37 const fetchPestDiseases = async () => {
38 try {
39 const response = await fetch("/api/pests-diseases");
40 const data = await response.json();
41
43 setPestDiseases(data.data);
44 } else {
45 console.error("Error fetching pest/disease library:", data.error);
46 }
47 } catch (error) {
48 console.error("Error fetching pest/disease library:", error);
49 }
50 };
51
52 fetchPestDiseases();
53 }, []);
54
59
60 try {
61 const response = await fetch("/api/analysis", {
62 method: "POST",
63 headers: {
91 try {
92 // First check if user exists
93 const checkResponse = await fetch(`/api/users?email=${encodeURIComponent(email)}`);
94 const checkData = await checkResponse.json();
95
99 } else {
100 // User doesn't exist, create a new user
101 const createResponse = await fetch("/api/users", {
102 method: "POST",
103 headers: {

town-hallAdminDashboard.tsx1 match

@stevekrouse•Updated 1 week ago
44
45 try {
46 const response = await fetch("/api/admin/data", {
47 headers: {
48 "Authorization": `Bearer ${password}`

TastkItProjectView.tsx9 matches

@diegoivo•Updated 1 week ago
27 // Buscar tarefas do projeto
28 useEffect(() => {
29 const fetchTasks = async () => {
30 setLoading(true);
31 setError(null);
32
33 try {
34 const response = await fetch(`/api/tasks/project/${project.id}`, {
35 method: "GET",
36 credentials: "include",
56 };
57
58 fetchTasks();
59 }, [project.id]);
60
97 if (editingTask) {
98 // Atualizar tarefa existente
99 const response = await fetch(`/api/tasks/${editingTask.id}`, {
100 method: "PUT",
101 headers: {
118 } else {
119 // Criar nova tarefa
120 const response = await fetch("/api/tasks", {
121 method: "POST",
122 headers: {
148 const handleToggleTaskCompletion = async (taskId: number) => {
149 try {
150 const response = await fetch(`/api/tasks/${taskId}/toggle`, {
151 method: "PATCH",
152 credentials: "include",
172
173 try {
174 const response = await fetch(`/api/tasks/${taskId}`, {
175 method: "DELETE",
176 credentials: "include",
192 const handleUpdateProject = async (name: string, color: string) => {
193 try {
194 const response = await fetch(`/api/projects/${project.id}`, {
195 method: "PUT",
196 headers: {
222
223 try {
224 const response = await fetch(`/api/projects/${project.id}`, {
225 method: "DELETE",
226 credentials: "include",

TastkItSidebar.tsx3 matches

@diegoivo•Updated 1 week ago
50 if (editingProject) {
51 // Atualizar projeto existente
52 const response = await fetch(`/api/projects/${editingProject.id}`, {
53 method: "PUT",
54 headers: {
68 } else {
69 // Criar novo projeto
70 const response = await fetch("/api/projects", {
71 method: "POST",
72 headers: {
101
102 try {
103 const response = await fetch(`/api/projects/${project.id}`, {
104 method: "DELETE",
105 credentials: "include",

AgriAiusers.ts4 matches

@morispolanco•Updated 1 week ago
85 return c.json(response);
86 } catch (error) {
87 console.error("Error fetching user:", error);
88 const response: ApiResponse<null> = {
89 success: false,
167 return c.json(response);
168 } catch (error) {
169 console.error("Error fetching farms:", error);
170 const response: ApiResponse<null> = {
171 success: false,
249 return c.json(response);
250 } catch (error) {
251 console.error("Error fetching crop records:", error);
252 const response: ApiResponse<null> = {
253 success: false,
278 return c.json(response);
279 } catch (error) {
280 console.error("Error fetching pest/disease records:", error);
281 const response: ApiResponse<null> = {
282 success: false,

TastkItDashboard.tsx3 matches

@diegoivo•Updated 1 week ago
21 // Buscar projetos ao carregar o dashboard
22 useEffect(() => {
23 const fetchProjects = async () => {
24 try {
25 const response = await fetch("/api/projects", {
26 method: "GET",
27 credentials: "include",
52 };
53
54 fetchProjects();
55 }, []);
56

fetch-socials4 file matches

@welson•Updated 23 hours ago
fetch and archive my social posts

fetchRssForSubcurrent2 file matches

@ashryanio•Updated 1 day ago