oliveGardenCharmain.tsx11 matches
1011useEffect(() => {
12fetchCoworkers();
13fetchPeopleBrought();
14}, []);
1516const fetchCoworkers = async () => {
17const response = await fetch("?action=list");
18const data = await response.json();
19setCoworkers(data);
20};
2122const fetchPeopleBrought = async () => {
23const response = await fetch("?action=getPeopleBrought");
24const data = await response.json();
25setPeopleBrought(data.peopleBrought);
30if (!newCoworker.trim()) return;
3132await fetch("?action=add", {
33method: "POST",
34body: JSON.stringify({ name: newCoworker }),
35});
36setNewCoworker("");
37fetchCoworkers();
38};
3941const value = parseInt(e.target.value) || 1;
42setPeopleBrought(value);
43await fetch("?action=updatePeopleBrought", {
44method: "POST",
45body: JSON.stringify({ peopleBrought: value }),
4849const deleteCoworker = async (id) => {
50await fetch("?action=delete", {
51method: "POST",
52body: JSON.stringify({ id }),
53});
54fetchCoworkers();
55};
56
twitterRecentMentionsmain.tsx3 matches
1// This val fetches recent tweets about @SnapAR or Lens Studio
2// Updated to use Social Data instead of Twitter API
312return retResponse(data.tweets);
13} catch (error) {
14console.error("Error fetching posts:", error);
15return new Response(JSON.stringify({ error: "Failed to fetch posts", details: error.message }), {
16status: 500,
17headers: { "Content-Type": "application/json" },
socialDataUpdatemain.tsx4 matches
1// This val fetches recent tweets about @SnapAR or Lens Studio, removes duplicates,
2// and displays them as embedded tweets with preview images on a dark background.
3// Updated to use Social Data instead of Twitter API
5import { socialDataSearch } from "https://esm.town/v/stevekrouse/socialDataSearch?v=5";
67// This val fetches recent social media posts about @SnapAR or Lens Studio using socialDataSearch,
8// and displays them as embedded posts with preview images on a dark background.
915return retResponse(data.tweets);
16} catch (error) {
17console.error("Error fetching posts:", error);
18return new Response(JSON.stringify({ error: "Failed to fetch posts", details: error.message }), {
19status: 500,
20headers: { "Content-Type": "application/json" },
valiantSalmonWarblermain.tsx1 match
30// handler may only run once now, where in the old runtime it
31// ran on every request. To migrate your code, you may have to
32// move some code that was outside your fetch handler to run inside it.
33// </p>
34
valiantSalmonWarblermain.tsx1 match
22handler may only run once now, where in the old runtime it
23ran on every request. To migrate your code, you may have to
24move some code that was outside your fetch handler to run inside it.
25</p>
26
1import { dataToRSS } from "https://esm.town/v/Glench/dataToRSS"
2import { fetch } from "https://esm.town/v/std/fetch"
3import process from "node:process"
428const show_id = TV_SHOWS_WATCHED[i]
29const url = `https://api.themoviedb.org/3/tv/${show_id}?api_key=${process.env.tmdb_api_key}`
30const resp = await fetch(url)
31const show = await resp.json()
32data.push(show)
getAppleDevicemain.tsx2 matches
1import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=5"
23export async function getAppleDevice(req: Request) {
4const deviceId = new URL(req.url).searchParams.get("search_keywords") as string
5if (!deviceId) return Response.json("Please provide a search_keywords query parameter")
6const html = await fetchText(
7`https://everymac.com/ultimate-mac-lookup/?search_keywords=${encodeURI(deviceId)}`,
8)
createGitHubContribGraphmain.tsx12 matches
184185useEffect(() => {
186fetchContributions()
187}, [])
188189const fetchContributions = async () => {
190setError(null)
191setContributionData(null)
192setUserData(null)
193try {
194const response = await fetch("/contributions", {
195method: "POST",
196headers: { "Content-Type": "application/json" },
197body: JSON.stringify({ username }),
198})
199if (!response.ok) throw new Error("Failed to fetch contributions")
200const data = await response.json()
201console.log("Fetched data:", data)
202setContributionData(data.contributionCalendar)
203setUserData(data.user)
204} catch (err) {
205console.error("Error fetching contributions:", err)
206setError(err.message)
207}
237const handleKeyPress = (event) => {
238if (event.key === "Enter") {
239fetchContributions()
240}
241}
309placeholder="Enter GitHub username"
310/>
311<button onClick={fetchContributions}>Fetch Commits</button>
312</div>
313{error && <p className="error">{error}</p>}
368if (request.method === "POST" && new URL(request.url).pathname === "/contributions") {
369const { username } = await request.json()
370const contributionData = await fetchGitHubContributions(username)
371return new Response(JSON.stringify(contributionData), {
372headers: { "Content-Type": "application/json" },
395}
396397async function fetchGitHubContributions(username: string) {
398const query = `
399query($username: String!) {
417`
418419const response = await fetch("https://api.github.com/graphql", {
420method: "POST",
421headers: {
427428if (!response.ok) {
429throw new Error("Failed to fetch GitHub data")
430}
431
iframeGridInfinitemain.tsx2 matches
142setIsLoading(true);
143try {
144const response = await fetch('/api/submit-url', {
145method: 'POST',
146headers: {
162const loadUrlDatabase = async () => {
163try {
164const response = await fetch('/api/load-urls');
165if (!response.ok) throw new Error('Failed to load URLs');
166const loadedUrls = await response.json();
XKCDComicOfTheDaymain.tsx3 matches
1import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=6";
2import { load } from "npm:cheerio";
34export default async function(req: Request): Promise<Response> {
5const response = await fetchText("https://xkcd.com/");
6const $ = load(response);
7const image = $("div#comic img").attr("src");
8return new Response(await (await fetch(image)).arrayBuffer());
9}