SermonGPTUImain.tsx9 matches
91const [autoScroll, setAutoScroll] = useState(true);
9293// Fetch saved sermons on component mount
94useEffect(() => {
95const fetchSermons = async () => {
96try {
97const response = await fetch(`${endpointURL}/sermons`);
98const data = await response.json();
99console.log("Fetched sermons:", data); // Debugging log
100// Ensure data is an array, even if it's empty
101setSermons(Array.isArray(data) ? data : []);
102} catch (error) {
103console.error("Failed to fetch sermons:", error);
104// Set to empty array in case of error
105setSermons([]);
107};
108109fetchSermons();
110}, []);
111169170try {
171const response = await fetch(`${endpointURL}/delete-sermon/${sermonId}`, {
172method: "DELETE",
173});
200201try {
202const res = await fetch(`${endpointURL}/save-sermon`, {
203method: "POST",
204headers: {
233234try {
235const res = await fetch(`${endpointURL}/stream`, {
236method: "POST",
237body: JSON.stringify({ question }),
legendaryRoseSwordfishmain.tsx9 matches
1617useEffect(() => {
18fetchData();
19}, []);
2021const fetchData = async () => {
22const response = await fetch("/api/data");
23const data = await response.json();
24setParticipants(data.participants);
28const handleLogin = async (e) => {
29e.preventDefault();
30const response = await fetch("/api/login", {
31method: "POST",
32headers: { "Content-Type": "application/json" },
49const handleSubmit = async (e) => {
50e.preventDefault();
51const response = await fetch("/api/update", {
52method: "POST",
53headers: { "Content-Type": "application/json" },
58setPoints("");
59setNote("");
60fetchData();
61}
62};
64const handleReset = async () => {
65if (window.confirm("Are you sure you want to reset all points?")) {
66const response = await fetch("/api/reset", { method: "POST" });
67if (response.ok) {
68fetchData();
69}
70}
7273const handleExportCSV = async () => {
74const response = await fetch("/api/export-csv");
75const blob = await response.blob();
76const url = window.URL.createObjectURL(blob);
SermonGPTAPImain.tsx2 matches
24}
25} catch (error) {
26console.error("Error fetching sermons:", error);
27return new Response(JSON.stringify([]), {
28headers: { "Content-Type": "application/json" },
86);
87} catch (error) {
88console.error("Error fetching sermons:", error);
89return new Response(JSON.stringify([]), {
90headers: { "Content-Type": "application/json" },
javascriptCoursemain.tsx1 match
48app.get("/javascriptCourse", javascriptCourse);
49app.get("/javascriptCourse/fizzBuzzTest", fizzBuzzTest);
50export default app.fetch;
blob_adminmain.tsx23 matches
234const [isDragging, setIsDragging] = useState(false);
235236const fetchBlobs = useCallback(async () => {
237setLoading(true);
238try {
239const response = await fetch(`/api/blobs?prefix=${encodeKey(searchPrefix)}&limit=${limit}`);
240const data = await response.json();
241setBlobs(data);
242} catch (error) {
243console.error("Error fetching blobs:", error);
244} finally {
245setLoading(false);
248249useEffect(() => {
250fetchBlobs();
251}, [fetchBlobs]);
252253const handleSearch = (e) => {
264setBlobContentLoading(true);
265try {
266const response = await fetch(`/api/blob?key=${encodeKey(clickedBlob.key)}`);
267const content = await response.text();
268setSelectedBlob({ ...clickedBlob, key: decodeKey(clickedBlob.key) });
269setEditContent(content);
270} catch (error) {
271console.error("Error fetching blob content:", error);
272} finally {
273setBlobContentLoading(false);
278const handleSave = async () => {
279try {
280await fetch(`/api/blob?key=${encodeKey(selectedBlob.key)}`, {
281method: "PUT",
282body: editContent,
290const handleDelete = async (key) => {
291try {
292await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
293setBlobs(blobs.filter(b => b.key !== key));
294if (selectedBlob && selectedBlob.key === key) {
307const key = `${searchPrefix}${file.name}`;
308formData.append("key", encodeKey(key));
309await fetch("/api/blob", { method: "POST", body: formData });
310const newBlob = { key, size: file.size, lastModified: new Date().toISOString() };
311setBlobs([newBlob, ...blobs]);
315}
316}
317fetchBlobs();
318};
319329try {
330const fullKey = `${searchPrefix}${key}`;
331await fetch(`/api/blob?key=${encodeKey(fullKey)}`, {
332method: "PUT",
333body: "",
344const handleDownload = async (key) => {
345try {
346const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
347const blob = await response.blob();
348const url = window.URL.createObjectURL(blob);
363if (newKey && newKey !== oldKey) {
364try {
365const response = await fetch(`/api/blob?key=${encodeKey(oldKey)}`);
366const content = await response.blob();
367await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
368method: "PUT",
369body: content,
370});
371await fetch(`/api/blob?key=${encodeKey(oldKey)}`, { method: "DELETE" });
372setBlobs(blobs.map(b => b.key === oldKey ? { ...b, key: newKey } : b));
373if (selectedBlob && selectedBlob.key === oldKey) {
383const newKey = `__public/${key}`;
384try {
385const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
386const content = await response.blob();
387await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
388method: "PUT",
389body: content,
390});
391await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
392setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
393if (selectedBlob && selectedBlob.key === key) {
402const newKey = key.slice(9); // Remove "__public/" prefix
403try {
404const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
405const content = await response.blob();
406await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
407method: "PUT",
408body: content,
409});
410await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
411setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
412if (selectedBlob && selectedBlob.key === key) {
825});
826827export default lastlogin((request: Request) => app.fetch(request));
7778useEffect(() => {
79async function fetchReleases() {
80try {
81const response = await fetch("https://ashryanio-getallreleasesfromdiscogs.web.val.run");
82if (!response.ok) {
83throw new Error(`HTTP error! status: ${response.status}`);
84}
85const fetchedRecords = await response.json();
86console.log(fetchedRecords);
87if (!Array.isArray(fetchedRecords)) {
88throw new Error("Received data is not an array");
89}
90const shuffledRecords = shuffleArray(fetchedRecords);
91setRecords(shuffledRecords);
92setIsLoading(false);
93} catch (error) {
94console.error("Failed to fetch releases:", error);
95setError(error.message);
96setIsLoading(false);
97}
98}
99fetchReleases();
100}, []);
101
Ms_Spanglermain.tsx2 matches
248249try {
250const response = await fetch('/chat', {
251method: 'POST',
252headers: {
312});
313314export default app.fetch;
gameplay_agentmain.tsx5 matches
7* If you define your agent with {@link Connect4Agent} or {@link PokerAgent},
8* then you can use {@link agentHandler} to create an http service that
9* serves it. The service it creates is a standard fetch handler that can be
10* used with a variety of different http server libraries.
11*
48* ]});
49*
50* Bun.serve({fetch: handler});
51* ```
52*
114115/**
116* Create standard fetch handler for an agent.
117*
118* Takes a list of agents and returns a handler that can be used to create an
119* agent http endpoint.
120* The handler implements the standard fetch interface and can be used with
121* a variety of different http server libraries.
122*
132*
133* @returns {(req: Request) => Promise<Response>} An async handler that can be
134* used with an http server that supports the fetch interface.
135*/
136export function agentHandler<
whoIsHiringmain.tsx12 matches
61}, [state.loading, state.hasMore]);
6263const fetchStories = async () => {
64try {
65const response = await fetch("/api/stories");
66if (!response.ok) throw new Error("Failed to fetch dates");
67const data = await response.json();
68setStories(data);
70}
71catch (err) {
72console.error("Error fetching stories:", err);
73}
74};
7576const fetchComments = async (query: string, story: string, page: number) => {
77try {
78dispatch({ type: "loading", value: true });
79const response = await fetch(`/api/comments?query=${encodeURIComponent(query)}&story=${story}&page=${page}`);
80if (!response.ok) throw new Error("Failed to fetch comments");
81const data = await response.json();
82setComments(prevComments => page === 1 ? data.hits : [...prevComments, ...data.hits]);
84dispatch({ type: "loading", value: false });
85} catch (err) {
86console.error("Error fetching comments:", err);
87dispatch({ type: "loading", value: false });
88}
99dispatch({ type: "hasMore", value: true });
100dispatch({ type: "query", value: newQuery });
101fetchComments(fullQuery, state.story, 1);
102};
103104useEffect(() => {
105fetchStories();
106107const handleScroll = () => {
122: "";
123const fullQuery = `${filtersQuery} ${state.query}`;
124fetchComments(fullQuery, state.story, state.page);
125}
126}
391tags: `comment, story_${story}`,
392page: 0,
393hitsPerPage: 100, // Fetch a moderate number of comments
394});
395
20setError("");
21try {
22const response = await fetch("/recipes", {
23method: "POST",
24headers: { "Content-Type": "application/json" },
32}
33} catch (err) {
34setError("An error occurred while fetching recipes. Please try again.");
35} finally {
36setLoading(false);
339340async function generateImage(recipeName: string): Promise<string> {
341const response = await fetch(`https://maxm-imggenurl.web.val.run/${encodeURIComponent(recipeName)}`);
342if (!response.ok) {
343throw new Error(`Failed to generate image for ${recipeName}`);