14
15 useEffect(() => {
16 fetchVoiceNote();
17 }, [voiceNoteId]);
18
19 const fetchVoiceNote = async () => {
20 try {
21 setLoading(true);
22 const response = await fetch(`/api/voicenotes/${voiceNoteId}`);
23 const data = await response.json();
24
32 } catch (err) {
33 setError("Failed to load voice message");
34 console.error("Error fetching voice message:", err);
35 } finally {
36 setLoading(false);
24 return c.json({ success: true, voiceNotes });
25 } catch (error) {
26 console.error("Error fetching voice notes:", error);
27 return c.json({ success: true, voiceNotes: [] });
28 }
97 return c.json({ success: true, voiceNote });
98 } catch (error) {
99 console.error("Error fetching voice note:", error);
100 return c.json({ success: false, error: "Failed to fetch voice note" }, 500);
101 }
102});
23app.route("/", staticRoutes);
24
25export default app.fetch;
9
10 useEffect(() => {
11 fetchVoiceNotes();
12 }, []);
13
14 const fetchVoiceNotes = async () => {
15 try {
16 setLoading(true);
17 const response = await fetch("/api/voicenotes");
18 const data = await response.json();
19
21 setVoiceNotes(data.voiceNotes || []);
22 } else {
23 setError(data.error || "Failed to fetch voice messages");
24 }
25 } catch (err) {
26 setError("Failed to load voice messages");
27 console.error("Error fetching voice messages:", err);
28 } finally {
29 setLoading(false);
120
121 try {
122 const response = await fetch(`/api/voicenotes/${voiceNoteId}`, {
123 method: "DELETE",
124 });
160 <p className="text-red-600 mb-4">{error}</p>
161 <button
162 onClick={fetchVoiceNotes}
163 className="px-6 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700"
164 >
177 </h2>
178 <button
179 onClick={fetchVoiceNotes}
180 className="px-4 py-2 bg-gray-100 text-gray-700 rounded-md hover:bg-gray-200 text-sm"
181 >
23});
24
25export default app.fetch;
32});
33
34export default app.fetch;
6});
7
8async function fetchBlockChildren(blockId: string): Promise<any[]> {
9 try {
10 const response = await notion.blocks.children.list({
14 const blocks = response.results;
15
16 // Recursively fetch children for blocks that have them
17 for (const block of blocks) {
18 if (block.has_children) {
19 block.children = await fetchBlockChildren(block.id);
20 }
21 }
23 return blocks;
24 } catch (error) {
25 console.error(`Error fetching children for block ${blockId}:`, error);
26 return [];
27 }
36 const blocks = response.results;
37
38 // Recursively fetch children for blocks that have them
39 for (const block of blocks) {
40 if (block.has_children) {
41 block.children = await fetchBlockChildren(block.id);
42 }
43 }
55
56 // 3. Send the request to the APNs server.
57 const apnsResponse = await fetch(
58 // The APNs endpoint includes the target device token.
59 `${endpoint}/${deviceToken}`,
50
51 // 3. Send the request to the APNs server.
52 const apnsResponse = await fetch(
53 // The APNs endpoint includes the target device token.
54 `https://api.push.apple.com/3/device/${deviceToken}`,
5 "mcp__playwright__browser_navigate",
6 "mcp__playwright__browser_click",
7 "WebFetch(domain:ai-sdk.dev)"
8 ],
9 "deny": []