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=48&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 8568 results for "fetch"(942ms)

Townieindex.ts1 match

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

TownieBranchSelect.tsx1 match

@valdottown•Updated 1 week 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 1 week 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 1 week 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 1 week 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 1 week ago
19 setError(null);
20 try {
21 const res = await fetch(ENDPOINT, {
22 method: "POST",
23 headers: {

TownieuseCreateBranch.tsx1 match

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

TownieuseBranches.tsx4 matches

@std•Updated 1 week ago
9 const [loading, setLoading] = useState(true);
10
11 const fetchData = async () => {
12 const endpoint = new URL(ENDPOINT, window.location.origin);
13 endpoint.searchParams.append("projectId", projectId);
14
15 const res = await fetch(endpoint, {
16 headers: {
17 "Authorization": "Bearer " + token,
24 useEffect(() => {
25 if (!projectId) return;
26 fetchData();
27 }, [projectId]);
28
29 return { data, loading, refetch: fetchData };
30}
31

TownieuseAuth.tsx1 match

@std•Updated 1 week ago
15 // replace all this with oauth when it's ready
16 try {
17 const res = await fetch("/api/user", {
18 headers: {
19 "Authorization": "Bearer " + valTownAPIKey,

TownieTODOs.md1 match

@std•Updated 1 week ago
47<!--
48
49- [x] refetch project data on create/etc
50- [x] Loading favicon
51- [x] Ensure main branch is default selected

fetchPaginatedData2 file matches

@nbbaier•Updated 2 weeks ago

FetchBasic1 file match

@fredmoon•Updated 2 weeks ago