iClickWolfitems.ts1 match
23return c.json(item);
24} catch (error) {
25console.error("Error fetching item:", error);
26
27// Return a default item with an error flag
iClickWolfHomePage.tsx4 matches
2728useEffect(() => {
29async function fetchItem() {
30try {
31const response = await fetch('/api/items');
32if (response.ok) {
33const data = await response.json();
47}
48} catch (error) {
49console.error('Error fetching item:', error);
50setItem(DEFAULT_ITEM);
51setError("Failed to connect to the server. Using default item data.");
55}
5657fetchItem();
58}, []);
59
iClickWolfPurchasePage.tsx1 match
32
33try {
34const response = await fetch('/api/checkout', {
35method: 'POST',
36headers: {
iClickWolfwebhook.ts1 match
35}
36
37const response = await fetch(emailSenderApiUrl, {
38method: "POST",
39headers: {
iClickWolfindex.ts2 matches
51});
5253// HTTP vals expect an exported "fetch handler"
54export default app.fetch;
5app.get("/", (c) => c.text("Go to /:projectsubdomain to see the project source"));
67export default app.fetch;
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;
stevensDemo.cursorrules5 matches
163```
1641655. **fetchTranspiledJavaScript** - Fetch and transpile TypeScript to JavaScript:
166```ts
167const jsCode = await fetchTranspiledJavaScript("https://esm.town/v/username/project/path/to/file.ts");
168```
169242243// Inject data to avoid extra round-trips
244const initialData = await fetchInitialData();
245const dataScript = `<script>
246window.__INITIAL_DATA__ = ${JSON.stringify(initialData)};
3003015. **API Design:**
302- `fetch` handler is the entry point for HTTP vals
303- Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`
304- Properly handle CORS if needed for external access