blueskyPostButtonmain.tsx1 match
10const postToBluesky = async () => {
11try {
12const response = await fetch("/post-bluesky", {
13method: "POST",
14headers: {
curiousCyanWalrusmain.tsx4 matches
1import { email } from "https://esm.town/v/std/email?v=9";
23// Fetches a random joke.
4function fetchRandomJoke() {
5const response = fetch(
6"https://official-joke-api.appspot.com/random_joke",
7);
10}
1112const randomJoke = fetchRandomJoke();
13const setup = randomJoke.setup;
14const punchline = randomJoke.punchline;
ThankYouNoteGeneratormain.tsx2 matches
70setError("");
71try {
72const response = await fetch("/generate", {
73method: "POST",
74headers: { "Content-Type": "application/json" },
197onClick={async () => {
198try {
199const response = await fetch(`/update/${noteId}`, {
200method: "POST",
201headers: { "Content-Type": "application/json" },
rssSummarizermain.tsx3 matches
20setError(null);
21try {
22const response = await fetch("/run-glif", {
23method: "POST",
24headers: { "Content-Type": "application/json" },
32}
33} catch (error) {
34console.error("Error fetching results:", error);
35setError("Failed to fetch results. Please try again.");
36}
37setLoading(false);
25};
2627const res = await fetch(`https://simple-api.glif.app`, {
28method: "POST",
29body: JSON.stringify(body),
BTCPriceCheckermain.tsx8 matches
1516useEffect(() => {
17async function fetchCryptoPrices() {
18try {
19// Fetch Bitcoin price from CoinDesk
20const bitcoinResponse = await fetch('https://api.coindesk.com/v1/bpi/currentprice/USD.json');
21const bitcoinData = await bitcoinResponse.json();
22const bitcoinPrice = bitcoinData.bpi.USD.rate_float;
2324// Fetch Solana price from CoinGecko (free API)
25const solanaResponse = await fetch('https://api.coingecko.com/api/v3/simple/price?ids=solana&vs_currencies=usd');
26const solanaData = await solanaResponse.json();
27const solanaPrice = solanaData.solana.usd;
39setLastUpdated(new Date());
40} catch (err) {
41setError('Could not fetch cryptocurrency prices');
42console.error(err);
43}
44}
4546fetchCryptoPrices();
47const interval = setInterval(fetchCryptoPrices, 60000); // Update every minute
48return () => clearInterval(interval);
49}, []);
oldProjectsmain.tsx1 match
94app.get("/projects/Debugging_Guide", Debugging_Guide);
9596export default app.fetch;
helpfulFuchsiaAmphibianmain.tsx5 matches
910useEffect(() => {
11async function fetchContent() {
12try {
13// Generate AI audio description
26setAudioDescription(audioDescCompletion.choices[0].message.content || "AI continues to revolutionize audio generation with innovative technologies in music composition, voice synthesis, and sound design.");
2728// Fetch AI-generated image
29const imageUrl = "https://maxm-imggenurl.web.val.run/AI technology visualization with abstract digital elements representing machine learning and neural networks";
30const response = await fetch(imageUrl);
3132if (!response.ok) {
36setGeneratedImage(imageUrl);
37} catch (error) {
38console.error("Error fetching AI content:", error);
39setGeneratedImage("https://maxm-imggenurl.web.val.run/AI technology visualization with abstract digital elements representing machine learning and neural networks");
40}
41}
4243fetchContent();
44}, []);
45
test_explorermain.tsx5 matches
10}
11return "Basic addition test passed!";`,
12async: `// Test an async function that fetches data
13const data = await module.fetchData();
14if (!Array.isArray(data) || data.length === 0) {
15throw new Error("Expected non-empty array");
16}
17return \`Fetched \${data.length} items successfully\`;`,
18error: `// Test error handling
19try {
36const runTests = async () => {
37try {
38const response = await fetch("/run-tests", {
39method: "POST",
40headers: { "Content-Type": "application/json" },
133} catch (error) {
134console.error("Error in runTests:", error);
135if (error instanceof TypeError && error.message.includes("Failed to fetch dynamically imported module")) {
136return {
137success: false,
165]
166167const response = await fetch(pipeline_url, {
168method: "POST",
169headers: {
192193194// Add new route for fetching source content
195export const fetchSource = async (c) => {
196const body = await c.req.json();
197const url = body.url;
212213try {
214const response = await fetch(pipeline_url, {
215method: "POST",
216headers: { "Content-Type": "application/json" },
223224if (!response.ok) {
225throw new Error(`Failed to fetch content from ${url}`);
226}
227229return c.json({ content: result.content || result.text || result });
230} catch (error) {
231console.error(`Error fetching source ${url}:`, error);
232return c.json({ error: error.message }, 500);
233}
328// app.post("/execute", execute);
329app.post("/execute2", execute2);
330app.post("/fetch-source", fetchSource);
331332const module = `
400},
401402async fetchSourceContent(url) {
403try {
404console.log('[fetchSourceContent] url:', url);
405const response = await fetch('/fetch-source', {
406method: 'POST',
407headers: { 'Content-Type': 'application/json' },
409});
410411if (!response.ok) throw new Error('Failed to fetch content from URL');
412const result = await response.json();
413if (result.error) throw new Error(result.error);
414return result.content;
415} catch (error) {
416console.error('Error fetching source:', error);
417return null;
418}
467if (this.isValidUrl(textToProcess)) {
468originalUrl = textToProcess;
469const content = await this.fetchSourceContent(textToProcess);
470if (!content) throw new Error('Failed to fetch content from URL');
471textToProcess = content;
472}
473474const response = await fetch('/execute2', {
475method: 'POST',
476headers: { 'Content-Type': 'application/json' },
715app.get("/", (c) => c.html(html));
716717export default (typeof Deno !== "undefined" && Deno.env.get("valtown")) ? app.fetch : app;
718719