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/$%7Burl%7D?q=fetch&page=4&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 8136 results for "fetch"(1316ms)

TownieLayoutRoute.tsx1 match

@valdottown•Updated 8 hours ago
4
5export function LayoutRoute () {
6 // TODO fetch here because we're not doing any caching
7 // and we want the user data in the header ?
8 // const projects = useProjects();

Townieindex.ts1 match

@valdottown•Updated 8 hours ago
62});
63
64export default app.fetch;
65

Townieindex.ts1 match

@valdottown•Updated 8 hours ago
21
22// This is the entry point for HTTP vals
23export default app.fetch;
24

TownieChatRoute.tsx8 matches

@valdottown•Updated 8 hours ago
46 files={project.data?.files}
47 branchId={branchId}
48 refetch={project.refetch}
49 />
50 </>
56 files,
57 branchId,
58 refetch,
59}: {
60 project: any;
61 files: any[];
62 branchId: string;
63 refetch: () => void;
64}) {
65 const { token, anthropicApiKey } = useAuth();
93 if (!messages?.length) return;
94 let last = messages.at(-1);
95 if (shouldRefetch(last)) {
96 refetch();
97 }
98 }, [messages]);
177}
178
179function shouldRefetch (message) {
180 for (let i = 0; i < message?.parts?.length; i++) {
181 let part = message.parts[i];
184 case "str_replace_editor":
185 if (part.toolInvocation?.args?.command === "create") {
186 // console.log("REFETCH (create)");
187 return true;
188 }
190 case "delete_file":
191 case "change_val_type":
192 // console.log("REFETCH (change type or delete)");
193 return true;
194 }

TownieBranchSelect.tsx1 match

@valdottown•Updated 8 hours ago
33 return;
34 }
35 branches.refetch();
36 if (res?.branch?.id) {
37 navigate(`/chat/${projectId}/branch/${res.branch.id}`);

test-blogindex.ts5 matches

@charmaine•Updated 8 hours ago
65 return c.json(posts);
66 } catch (error) {
67 console.error("Error fetching blog posts:", error);
68 return c.json({ error: "Failed to fetch blog posts" }, 500);
69 }
70});
82 return c.json(post);
83 } catch (error) {
84 console.error("Error fetching blog post:", error);
85 return c.json({ error: "Failed to fetch blog post" }, 500);
86 }
87});
88
89// This is the entry point for HTTP vals
90export default app.fetch;

TownieuseProject.tsx5 matches

@std•Updated 8 hours ago
11 const [error, setError] = useState(null);
12
13 const fetchData = async () => {
14 try {
15 const projectEndpoint = new URL(PROJECT_ENDPOINT, window.location.origin);
23 };
24
25 const { project } = await fetch(projectEndpoint, { headers })
26 .then(res => res.json());
27 const { files } = await fetch(filesEndpoint, { headers })
28 .then(res => res.json());
29
40 useEffect(() => {
41 if (!projectId) return;
42 fetchData();
43 }, [projectId, branchId]);
44
45 return { data, loading, error, refetch: fetchData };
46}
47

TownieuseProjects.tsx5 matches

@std•Updated 8 hours ago
10 const [error, setError] = useState(null);
11
12 const fetchData = async () => {
13 try {
14 const res = await fetch(ENDPOINT, {
15 headers: {
16 "Authorization": "Bearer " + token,
18 })
19 const data = await res.json();
20 console.log("useProjects fetchData", { res, data });
21 if (!res.ok) {
22 console.error(data);
39
40 useEffect(() => {
41 fetchData();
42 }, []);
43
44 return { data, loading, error, refetch: fetchData };
45}
46

TownieuseCreateProject.tsx1 match

@std•Updated 8 hours ago
19 setError(null);
20 try {
21 const res = await fetch(ENDPOINT, {
22 method: "POST",
23 headers: {

TownieuseCreateBranch.tsx1 match

@std•Updated 8 hours ago
16 setData(null);
17 setError(null);
18 const res = await fetch(ENDPOINT, {
19 method: "POST",
20 headers: {

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago