eink-frame-remixindex.tsx1 match
46<h3 class="text-xl pb-2">Example frame previews</h3>
47<p>
48Frames data is fetched, cached, and displayed with val.town, then fetched and rendered on an e-ink
49display.
50</p>
eink-frame-remixhemolog.tsx1 match
32))
33)
34: <div className="text-2xl mt-2.5">Unable to fetch data</div>}
35</ul>
36</Content>
eink-frame-remixhemolog.ts2 matches
1import fetchWithCache from "./fetchWithCache.ts";
23export type HEMOLOG_TREATMENT = {
22const cacheKey = "hemolog-recent-treatments";
2324const data: HEMOLOG_TREATMENT[] = await fetchWithCache(apiUrl, cacheKey).then((res) => res.json());
25return new Response(JSON.stringify(data), {
26headers: {
1617try {
18const response = await fetch(generateUrl);
19if (!response.ok) {
20throw new Error(`APIFlash responded with status: ${response.status}`);
eink-frame-remixfetchWithCache.ts5 matches
6};
78export default async function fetchWithCache(
9apiUrl: string,
10cacheKey: string,
37}
3839// Fetch new data if no valid cache exists
40const response = await fetch(apiUrl);
41if (!response.ok) {
42throw new Error(`API responded with status: ${response.status}`);
64});
65} catch (error) {
66console.error("Error fetching data:", error);
67return new Response(JSON.stringify({ error: "Failed to fetch data" }), {
68status: 500,
69headers: { "Content-Type": "application/json" },
eink-frame-remixapod.ts2 matches
1import fetchWithCache from "./fetchWithCache.ts";
23export type APOD = {
18const cacheMinutes = 60;
1920const data: APOD = await fetchWithCache(url, cacheKey, cacheMinutes).then((res) => res.json());
2122if (!data) {
untitled-9414main.tsx2 matches
1415async function listWebhooks(apiKey: string, propertyId: string): Promise<CloudbedsWebhook[]> {
16const res = await fetch(`https://hotels.cloudbeds.com/api/v1.2/getWebhooks?propertyID=${propertyId}`, {
17headers: { Authorization: `Bearer ${apiKey}` },
18});
37});
3839const res = await fetch("https://hotels.cloudbeds.com/api/v1.2/deleteWebhook", {
40method: "POST",
41headers: {
stevensDemosendDailyBrief.ts1 match
135const lastSunday = today.startOf("week").minus({ days: 1 });
136137// Fetch relevant memories using the utility function
138const memories = await getRelevantMemories();
139
stevensDemoNotebookView.tsx12 matches
67const [currentPage, setCurrentPage] = useState(1);
6869const fetchMemories = useCallback(async () => {
70setLoading(true);
71setError(null);
72try {
73const response = await fetch(API_BASE);
74if (!response.ok) {
75throw new Error(`HTTP error! status: ${response.status}`);
78setMemories(data);
79} catch (e) {
80console.error("Failed to fetch memories:", e);
81setError(e.message || "Failed to fetch memories.");
82} finally {
83setLoading(false);
8687useEffect(() => {
88fetchMemories();
89}, [fetchMemories]);
9091const handleAddMemory = async (e: React.FormEvent) => {
100101try {
102const response = await fetch(API_BASE, {
103method: "POST",
104headers: { "Content-Type": "application/json" },
112setNewMemoryTags("");
113setShowAddForm(false);
114await fetchMemories();
115} catch (e) {
116console.error("Failed to add memory:", e);
123124try {
125const response = await fetch(`${API_BASE}/${id}`, {
126method: "DELETE",
127});
129throw new Error(`HTTP error! status: ${response.status}`);
130}
131await fetchMemories();
132} catch (e) {
133console.error("Failed to delete memory:", e);
155156try {
157const response = await fetch(`${API_BASE}/${editingMemory.id}`, {
158method: "PUT",
159headers: { "Content-Type": "application/json" },
164}
165setEditingMemory(null);
166await fetchMemories();
167} catch (e) {
168console.error("Failed to update memory:", e);
stevensDemoindex.ts2 matches
135));
136137// HTTP vals expect an exported "fetch handler"
138export default app.fetch;