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/$2?q=fetch&page=13&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 11208 results for "fetch"(687ms)

untitled-2689main.tsx13 matches

@wahobd•Updated 1 day ago
604 const triggerTelegramInteraction = async (chatId) => {
605 try {
606 const response = await fetch("/handle-telegram-interaction", {
607 method: "POST",
608 headers: { "Content-Type": "application/json" },
621 };
622
623 const fetchUserBalance = async () => {
624 let userId = null;
625 let isTelegramEnv = false;
674 if (userId) {
675 try {
676 const response = await fetch(`/get-balance?uid=${userId}`);
677 if (!response.ok) {
678 try {
699 }
700 } catch (error) {
701 console.error("Failed to fetch or process balance:", error.toString());
702 setBalance("Error");
703 }
704 } else {
705 console.error("User ID could not be determined for balance fetching.");
706 setBalance("--.--");
707 }
731 window.Telegram.WebApp.ready();
732 }
733 fetchUserBalance();
734 } else if (isTelegramWebAppPresent) {
735 console.log(
736 "Telegram script present, but user data not immediately available or ready() pending. Setting timeout for balance fetch.",
737 );
738 if (window.Telegram.WebApp.ready) {
739 window.Telegram.WebApp.ready();
740 }
741 scriptLoadTimeoutId = setTimeout(fetchUserBalance, 300);
742 } else {
743 console.log("Not in Telegram environment. Proceeding as web user for balance fetch.");
744 fetchUserBalance();
745 }
746 }
882 setShowSpinner(true);
883
884 const response = await fetch("/save-credentials", {
885 method: "POST",
886 headers: { "Content-Type": "application/json" },
1884 const sendActualTelegramAPIMessage = async (botToken, chatId, text, parseMode = "Markdown") => {
1885 try {
1886 const response = await fetch(`https://api.telegram.org/bot${botToken}/sendMessage`, {
1887 method: "POST",
1888 headers: { "Content-Type": "application/json" },
2194 if (confirm('Are you sure you want to unban this user?')) {
2195 try {
2196 const response = await fetch('/unban-telegram-user', {
2197 method: 'POST',
2198 headers: { 'Content-Type': 'application/json' },

personalShopperindex.ts7 matches

@bgschiller•Updated 1 day ago
304async function logout(): Promise<void> {
305 try {
306 await fetch("/auth/logout", { method: "POST" });
307 window.location.reload();
308 } catch (error) {
318
319 try {
320 const response = await fetch("/api/user/location", {
321 method: "PUT",
322 headers: { "Content-Type": "application/json" },
349
350 try {
351 const response = await fetch(
352 `/api/locations/search?zipCode=${
353 encodeURIComponent(
428): Promise<void> {
429 try {
430 const response = await fetch("/api/user/location", {
431 method: "PUT",
432 headers: { "Content-Type": "application/json" },
482 if (userData && userData.preferredLocationId) {
483 try {
484 const response = await fetch(
485 `/api/locations/${userData.preferredLocationId}`,
486 );
502async function loadGuidanceCount(): Promise<void> {
503 try {
504 const response = await fetch("/api/guidance");
505 const guidance = await response.json();
506 document.getElementById("guidance-count")!.textContent = guidance.length.toString();
512async function loadSelectionsCount(): Promise<void> {
513 try {
514 const response = await fetch("/api/selections");
515 const selections = await response.json();
516 document.getElementById("selections-count")!.textContent = selections.length.toString();

cookie-investigationindex.http.ts1 match

@bgschiller•Updated 1 day ago
73});
74
75export default app.fetch;
76

ideaindex.ts1 match

@mtaufen•Updated 1 day ago
19});
20
21export default app.fetch;

TownieuseUser.tsx4 matches

@chadparker•Updated 1 day ago
8 const [error, setError] = useState(null);
9
10 const fetchData = async () => {
11 try {
12 const userEndpoint = new URL(USER_ENDPOINT, window.location.origin);
13
14 const res = await fetch(userEndpoint);
15 const data = await res.json();
16 if (!res.ok) {
33
34 useEffect(() => {
35 fetchData();
36 }, []);
37
38 return { data, loading, error, refetch: fetchData };
39}
40

TownieuseProject.tsx5 matches

@chadparker•Updated 1 day ago
9 const [error, setError] = useState(null);
10
11 const fetchData = async () => {
12 try {
13 const projectEndpoint = new URL(PROJECT_ENDPOINT, window.location.origin);
17 if (branchId) filesEndpoint.searchParams.append("branchId", branchId);
18
19 const { project } = await fetch(projectEndpoint).then((res) =>
20 res.json()
21 );
22 const { files } = await fetch(filesEndpoint).then((res) => res.json());
23
24 setData({ project, files });
34 useEffect(() => {
35 if (!projectId) return;
36 fetchData();
37 }, [projectId, branchId]);
38
39 return { data, loading, error, refetch: fetchData };
40}
41

TownieuseProjects.tsx4 matches

@chadparker•Updated 1 day ago
8 const [error, setError] = useState(null);
9
10 const fetchData = async () => {
11 try {
12 const res = await fetch(ENDPOINT);
13 const data = await res.json();
14 if (!res.ok) {
32
33 useEffect(() => {
34 fetchData();
35 }, []);
36
37 return { data, loading, error, refetch: fetchData };
38}
39

TownieuseCreateProject.tsx1 match

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

TownieuseCreateBranch.tsx1 match

@chadparker•Updated 1 day ago
12 setData(null);
13 setError(null);
14 const res = await fetch(ENDPOINT, {
15 method: "POST",
16 body: JSON.stringify({

TownieuseBranches.tsx4 matches

@chadparker•Updated 1 day ago
7 const [loading, setLoading] = useState(true);
8
9 const fetchData = async () => {
10 const endpoint = new URL(ENDPOINT, window.location.origin);
11 endpoint.searchParams.append("projectId", projectId);
12
13 const res = await fetch(endpoint)
14 .then(res => res.json());
15 setData(res.branches);
19 useEffect(() => {
20 if (!projectId) return;
21 fetchData();
22 }, [projectId]);
23
24 return { data, loading, refetch: fetchData };
25}

fetch-socials4 file matches

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

fetchRssForSubcurrent2 file matches

@ashryanio•Updated 20 hours ago