passwordgamemain.tsx1 match
54setLoading(true);
55try {
56const response = await fetch("/", {
57method: "POST",
58body: JSON.stringify({ level, password, requirements }),
skilledCoffeePanthermain.tsx2 matches
95
96// Test API connection
97fetch(API_URL + "/")
98.then(response => {
99if (!response.ok) throw new Error();
138
139try {
140const response = await fetch(API_URL + "/message", {
141method: "POST",
142headers: {
findSlamArticlesmain.tsx1 match
24
25try {
26const response = await fetch(targetUrl);
27const html = await response.text();
28const $ = cheerio.load(html);
slackReplyToMessagemain.tsx4 matches
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
23export const slackReplyToMessage = async (req: Request) => {
16// Reply to app_mention events
17if (body.event.type === "app_mention") {
18const usersResponse = await fetchJSON(
19`https://slack.com/api/usergroups.users.list?usergroup=S07S1056LN6`,
20{
28// Ensure the response was successful and contains users
29if (!usersResponse.ok || !usersResponse.users || usersResponse.users.length === 0) {
30console.error("Failed to fetch users or no users found");
31return new Response(undefined, { status: 500 });
32}
3738// Send a message mentioning the randomly selected user
39const result = await fetchJSON(
40"https://slack.com/api/chat.postMessage",
41{
40}
4142const response = await fetch("/create", {
43method: "POST",
44headers: { "Content-Type": "application/json" },
138139// Record the win
140await fetch("/record-win", {
141method: "POST",
142headers: { "Content-Type": "application/json" },
232233useEffect(() => {
234fetchGames();
235}, []);
236237const fetchGames = async () => {
238const response = await fetch("/admin/games");
239const data = await response.json();
240setGames(data);
243const deleteGame = async (id: string) => {
244if (!confirm(`Delete game "${games.find(g => g.id === id)?.name}"?`)) return;
245await fetch(`/admin/games/${id}`, { method: "DELETE" });
246fetchGames();
247};
248249const deleteAllGames = async () => {
250if (!confirm("Delete ALL games? This cannot be undone!")) return;
251await fetch("/admin/games", { method: "DELETE" });
252fetchGames();
253};
254
blob_adminmain.tsx2 matches
1/** @jsxImportSource https://esm.sh/hono@4.0.8/jsx **/
23import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import view_route from "https://esm.town/v/pomdtr/blob_admin_blob";
5import create_route from "https://esm.town/v/pomdtr/blob_admin_create";
137});
138139export default modifyFetchHandler(passwordAuth(app.fetch));
15<label for="dateSelect">Select Date: </label>
16<input type="date" id="dateSelect">
17<button id="fetchButton" class="fetch-button">Fetch Data</button>
18</div>
19<div class="table-container">
50// Set up date picker with yesterday as default
51const dateSelect = document.getElementById('dateSelect');
52const fetchButton = document.getElementById('fetchButton');
53const loadingElement = document.getElementById('loading');
54
65dateSelect.max = formatDate(yesterday); // Prevent future dates
6667async function fetchData() {
68try {
69loadingElement.classList.remove('hidden');
70fetchButton.disabled = true;
71
72const selectedDate = dateSelect.value;
73const url = \`https://kalshi-public-docs.s3.amazonaws.com/reporting/market_data_\${selectedDate}.json\`;
74const response = await fetch(url);
75if (!response.ok) {
76throw new Error('Data not available for selected date');
81renderTable();
82} catch (error) {
83console.error('Error fetching data:', error);
84document.getElementById('tableBody').innerHTML =
85'<tr><td colspan="10" style="text-align: center;">No data available for selected date</td></tr>';
86} finally {
87loadingElement.classList.add('hidden');
88fetchButton.disabled = false;
89}
90}
150});
151152// Add fetch button click handler
153fetchButton.addEventListener('click', fetchData);
154155// Initial fetch
156fetchData();
157</script>
158</body>
187}
188189.fetch-button {
190padding: 8px 16px;
191background-color: #007bff;
197}
198199.fetch-button:hover {
200background-color: #0056b3;
201}
202203.fetch-button:disabled {
204background-color: #ccc;
205cursor: not-allowed;
42let currentSort = { key: 'daily_volume', direction: 'desc' };
4344async function fetchData() {
45try {
46const response = await fetch('https://kalshi-public-docs.s3.amazonaws.com/reporting/market_data_2024-10-22.json');
47const data = await response.json();
48tableData = Array.isArray(data) ? data : [data]; // Handle single object or array
50renderTable();
51} catch (error) {
52console.error('Error fetching data:', error);
53}
54}
115});
116117// Initial fetch
118fetchData();
119</script>
120</body>
1import { Hono } from "npm:hono@3";
2import { cors } from "npm:hono/cors";
3import { fetch } from "https://esm.town/v/std/fetch";
45const app = new Hono();
1920try {
21const response = await fetch(url, options);
22if (!response.ok) {
23throw new Error(`HTTP error! status: ${response.status}`);
5354console.log('search url:', url)
55const response = await fetch(url, options);
56if (!response.ok) {
57throw new Error(`HTTP error! status: ${response.status}`);
111});
112113export default app.fetch;
114export { unpaywallDOI, unpaywallSearch };
promptOrangeHookwormmain.tsx5 matches
78useEffect(() => {
9fetch('/weather')
10.then(response => response.json())
11.then(data => setWeather(data))
12.catch(error => console.error('Error fetching weather:', error));
13}, []);
1441export default async function server(request: Request): Promise<Response> {
42if (request.url.endsWith('/weather')) {
43const weatherData = await fetchWeather();
44return new Response(JSON.stringify(weatherData), {
45headers: { 'Content-Type': 'application/json' },
71}
7273async function fetchWeather() {
74const response = await fetch(
75'https://api.open-meteo.com/v1/forecast?latitude=40.5853&longitude=-105.0844¤t_weather=true&daily=temperature_2m_max,temperature_2m_min&timezone=America%2FDenver'
76);