20
21 try {
22 const response = await fetch('/chat', {
23 method: 'POST',
24 headers: { 'Content-Type': 'application/json' },
182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({
58 try {
59 // Simulate volume boost
60 const result = await fetch('/volume-boost', {
61 method: 'POST',
62 body: JSON.stringify({ amount: boostAmount })
75 try {
76 // Simulate price boost
77 const result = await fetch('/price-boost', {
78 method: 'POST',
79 body: JSON.stringify({ amount: boostAmount })
5
6export default async function(interval: Interval) {
7 const response = await fetch("https://www.sperrychalet.com/vacancy_s.html");
8 const body = await response.text();
9 const $ = cheerio.load(body);
30 if (url.pathname === "/test.json") return Response.json({ ok: true });
31 if (url.pathname !== "/")
32 return fetch(
33 `https://stevekrouse.github.io/${url.pathname}${url.search}`,
34 request as any as RequestInit,
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export const gsheet_call = async (service_account, sheet_id, method, action, data) => {
10 const token = await getToken(service_account, googleAuthOptions);
11 console.log(`https://sheets.googleapis.com/v4/spreadsheets/${sheet_id}/${action}`);
12 const result = fetchJSON(
13 `https://sheets.googleapis.com/v4/spreadsheets/${sheet_id}/${action}`,
14 {
17
18 useEffect(() => {
19 async function fetchCryptoData() {
20 try {
21 const priceResponse = await fetch('https://api.coingecko.com/api/v3/simple/price?ids=bitcoin,ethereum,dogecoin&vs_currencies=usd&include_24hr_change=true');
22 const priceData = await priceResponse.json();
23
24 const volumeResponse = await fetch('https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&ids=bitcoin,ethereum,dogecoin&order=market_cap_desc&per_page=3&page=1&sparkline=false&price_change_percentage=24h');
25 const volumeData = await volumeResponse.json();
26
52 setRecommendations(processedRecommendations);
53 } catch (error) {
54 console.error("Failed to fetch crypto data", error);
55 }
56 }
57
58 fetchCryptoData();
59 const interval = setInterval(fetchCryptoData, 60000); // Update every minute
60 return () => clearInterval(interval);
61 }, []);
18
19 useEffect(() => {
20 fetchReminders();
21 }, []);
22
23 const fetchReminders = async () => {
24 try {
25 const response = await fetch('/reminders');
26 const data = await response.json();
27 setReminders(data);
28 } catch (error) {
29 console.error('Failed to fetch reminders', error);
30 }
31 };
34 e.preventDefault();
35 try {
36 const response = await fetch('/reminders', {
37 method: 'POST',
38 headers: { 'Content-Type': 'application/json' },
40 });
41 if (response.ok) {
42 fetchReminders();
43 setNewReminder({
44 title: '',
57 const toggleCompletion = async (id, currentStatus) => {
58 try {
59 const response = await fetch(`/reminders/${id}/toggle`, {
60 method: 'PATCH',
61 headers: { 'Content-Type': 'application/json' },
63 });
64 if (response.ok) {
65 fetchReminders();
66 }
67 } catch (error) {
72 const deleteReminder = async (id) => {
73 try {
74 const response = await fetch(`/reminders/${id}`, { method: 'DELETE' });
75 if (response.ok) {
76 fetchReminders();
77 }
78 } catch (error) {
182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({
24
25 try {
26 const response = await fetch(url);
27 if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
28