cerebras_codermain.tsx7 matches
3637useEffect(() => {
38async function fetchStats() {
39const response = await fetch("/dashboard-stats");
40const data = await response.json();
41setStats(data);
42}
43fetchStats();
44}, []);
45128129useEffect(() => {
130async function fetchUsageStats() {
131const response = await fetch("/usage-stats");
132const data = await response.json();
133setUsageStats(data);
134}
135fetchUsageStats();
136}, []);
137141142try {
143const response = await fetch("/", {
144method: "POST",
145body: JSON.stringify({
blueskyAlertmain.tsx1 match
7const agent = new AtpAgent({
8service: "https://public.api.bsky.app/",
9// fetch, ideally we'd use our @std/fetch proxy here but that doesn't work and I don't know why
10});
11
simpleChatAPImain.tsx5 matches
1415useEffect(() => {
16fetchMessages();
17}, []);
1819const fetchMessages = async () => {
20const response = await fetch("/messages");
21const data = await response.json();
22setMessages(data);
30}
31localStorage.setItem("chatUsername", username);
32await fetch("/messages", {
33method: "POST",
34headers: { "Content-Type": "application/json" },
39});
40setNewMessage("");
41fetchMessages();
42};
43
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;