34
35 useEffect(() => {
36 async function fetchTopGames() {
37 try {
38 // Fetch top 50 free games from US App Store
39 const response = await fetch(
40 `https://itunes.apple.com/us/rss/topfreeapplications/limit=50/genre=${selectedCategory === 'all' ? '6014' : selectedCategory}/json`
41 );
42
43 if (!response.ok) {
44 throw new Error('Failed to fetch game data');
45 }
46
64 }
65 }
66 fetchTopGames();
67 }, [selectedCategory]);
68
1import { email } from "https://esm.town/v/std/email?v=9";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3import { nominatimSearch } from "https://esm.town/v/stevekrouse/nominatimSearch";
4import { weatherGovGrid } from "https://esm.town/v/stevekrouse/weatherGovGrid";
14 lon,
15 });
16 let { properties: { periods } } = await fetchJSON(
17 grid.forecastHourly,
18 );
182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({
182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({
182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({
182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({
39 useEffect(() => {
40 // Load initial data from server
41 fetchInitialData();
42 }, []);
43
44 async function fetchInitialData() {
45 try {
46 const response = await fetch('/load-data');
47 const data = await response.json();
48 setTotalEarnings(data.totalEarnings);
65
66 try {
67 const response = await fetch('/record-session', {
68 method: 'POST',
69 headers: { 'Content-Type': 'application/json' },
88 async function clearEarnings() {
89 try {
90 const response = await fetch('/clear-earnings', { method: 'POST' });
91 const data = await response.json();
92 setTotalEarnings(0);
292 `, [earnings]);
293
294 // Fetch updated data with more detailed session history
295 const totalEarningsResult = await sqlite.execute(`
296 SELECT total_earnings FROM ${KEY}_total_earnings_${SCHEMA_VERSION}
189 }
190 // Publish message
191 return await fetch(`${this.serverUrl}/${this.topic}`, {
192 method: "POST",
193 body: this.message ?? this.file,
66
67 const callAnthropicAPI = async (prompt) => {
68 const response = await fetch("https://api.anthropic.com/v1/messages", {
69 method: "POST",
70 headers: {
101 });
102
103 const response = await fetch(`${apiUrl}?${params}`);
104 const data = await response.json();
105 const pages = data.query.pages;
182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({