reqEvaltownmain.tsx1 match
32const url = new URL("." + pathname, "http://localhost:" + port);
33url.search = search;
34const resp = await fetch(url, {
35method: req.method,
36headers: req.headers,
valtowntownmain.tsx1 match
172});
173174export default app.fetch.bind(app);
175176const css = `
discordActivityClientmain.tsx6 matches
51// /.proxy/ is prepended here in compliance with CSP
52// see https://discord.com/developers/docs/activities/development-guides#construct-a-full-url
53const response = await fetch("/.proxy/api/token", {
54method: "POST",
55headers: {
7374/**
75* This function fetches the current voice channel over RPC. It then creates a
76* text element that displays the voice channel's name
77*/
106* This function utilizes RPC and HTTP apis, in order show the current guild's avatar
107* Here are the steps:
108* 1. From RPC fetch the currently selected voice channel, which contains the voice channel's guild id
109* 2. From the HTTP API fetch a list of all of the user's guilds
110* 3. Find the current guild's info, including its "icon"
111* 4. Append to the UI an img tag with the related information
117}
118119// 1. From the HTTP API fetch a list of all of the user's guilds
120const guilds = await fetch(
121"https://discord.com/api/users/@me/guilds",
122{
blobbyFacemain.tsx18 matches
2import { blobby } from "https://esm.town/v/yawnxyz/blobby";
3import { fileTypeFromBuffer } from 'npm:file-type';
4import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
5import { cors } from "npm:hono/cors";
6757677// Endpoint to fetch blob by key
78app.get("/blob/:key", async (c) => {
79const key = c.req.param('key');
219this.blobs[key] = {isLoading: true};
220
221const response = await fetch('/blob/' + key);
222const contentType = response.headers.get('Content-Type');
223blob.type = contentType || 'text/plain';
249let blob = this.blobs[key];
250try {
251const response = await fetch('/create/' + key, {
252method: 'POST',
253headers: {
273274// Send a delete request to the server
275const response = await fetch('/delete/' + key, { method: 'GET' });
276277// Check the response status
343
344try {
345const response = await fetch('/upload/' + key, {
346method: 'POST',
347body: formData,
368
369try {
370const response = await fetch('/uploadUrl' + '?key=' + key + '&url=' + url);
371
372if (!response.ok) {
391if (!this.newKeyName) return;
392try {
393const response = await fetch('/rename?key='+key+'&newKey='+this.newKeyName);
394if (!response.ok) {
395throw new Error('Failed to rename blob');
559async loadBlob() {
560this.isLoading = true;
561const response = await fetch('/blob/' + this.key);
562const contentType = response.headers.get('Content-Type');
563this.blobType = contentType || 'text/plain';
583async updateCreate() {
584try {
585const response = await fetch('/create/' + this.key, {
586method: 'POST',
587headers: {
606607try {
608const response = await fetch('/upload/' + this.key, {
609method: 'POST',
610body: formData,
626if (this.uploadUrl) {
627try {
628const response = await fetch('/uploadUrl?key=' + this.key + '&url=' + this.uploadUrl);
629630if (!response.ok) {
643if (!this.newKeyName) return;
644try {
645const response = await fetch('/rename?key=' + this.key + '&newKey=' + this.newKeyName);
646if (!response.ok) {
647throw new Error('Failed to rename blob');
661}
662try {
663const response = await fetch('/delete/' + this.key, { method: 'GET' });
664if (!response.ok) {
665throw new Error('Failed to delete blob');
763764765export default app.fetch;
766767// import { verifyToken } from "https://esm.town/v/pomdtr/verifyToken";
770771772// export default passwordAuth(app.fetch);
773774// export default passwordAuth(app.fetch, { verifyPassword: verifyToken });
775// export default passwordAuth(app.fetch, { verifyPassword: (password) => password == "yespleasetakealook" });
776// }, { verifyPassword: (password) => password == Deno.env.get("VAL_PASSWORD") });
777
6465try {
66const response = await fetch('${httpEndpoint}', {
67method: 'POST',
68body: code,
fearlessVioletAnteatermain.tsx5 matches
42e.preventDefault();
43const finalAmount = showCustomAmount ? parseFloat(customAmount) : amount;
44const response = await fetch("/create-checkout-session", {
45method: "POST",
46headers: { "Content-Type": "application/json" },
205206useEffect(() => {
207fetchPayments();
208const urlParams = new URLSearchParams(window.location.search);
209if (urlParams.get('success') === 'true') {
212}, []);
213214const fetchPayments = async () => {
215const response = await fetch('/get-payments');
216const data = await response.json();
217setPayments(data);
223<div className="w-full max-w-[90%] flex flex-col md:flex-row gap-8">
224<div className="w-full md:w-1/2 order-2 md:order-1">
225<TippingForm onPaymentSuccess={fetchPayments} />
226</div>
227<div className="w-full md:w-1/2 order-1 md:order-2">
prodigiousTanTurtlemain.tsx18 matches
111const handleSubmit = async (e) => {
112e.preventDefault();
113const response = await fetch('/api/login', {
114method: 'POST',
115headers: { 'Content-Type': 'application/json' },
146const handleSubmit = async (e) => {
147e.preventDefault();
148const response = await fetch('/api/register', {
149method: 'POST',
150headers: { 'Content-Type': 'application/json' },
181const handleSubmit = async (e) => {
182e.preventDefault();
183const response = await fetch('/api/profile', {
184method: 'PUT',
185headers: {
225226useEffect(() => {
227fetchVehicles();
228fetchTransactions();
229}, []);
230231const fetchVehicles = async () => {
232const response = await fetch('/api/vehicles', {
233headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
234});
239};
240241const fetchTransactions = async () => {
242const response = await fetch('/api/transactions', {
243headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
244});
275276useEffect(() => {
277fetchTollBooths();
278}, []);
279280const fetchTollBooths = async () => {
281const response = await fetch('/api/toll-booths', {
282headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
283});
312313useEffect(() => {
314fetchRevenueReport();
315fetchTrafficAnalytics();
316}, []);
317318const fetchRevenueReport = async () => {
319const response = await fetch('/api/revenue-report', {
320headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
321});
326};
327328const fetchTrafficAnalytics = async () => {
329const response = await fetch('/api/traffic-analytics', {
330headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
331});
fastCoffeeLizardmain.tsx5 matches
126127<script>
128async function fetchData() {
129try {
130const response = await fetch(window.location.href, { headers: { 'accept': 'application/json' } });
131const data = await response.json();
132136thermometerFill.style.width = percentage + "%";
137} catch (error) {
138console.error('Error fetching data:', error);
139}
140}
141142fetchData(); // Fetch data on page load
143</script>
144</body>
161});
162} catch (error) {
163console.error("Error fetching data:", error);
164return new Response(`Error: ${error.message}`, { status: 500 });
165}
sqliteExplorerAppmain.tsx4 matches
1/** @jsxImportSource https://esm.sh/hono@latest/jsx **/
23import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import { iframeHandler } from "https://esm.town/v/nbbaier/iframeHandler";
5import { resetStyle } from "https://esm.town/v/nbbaier/resetStyle";
16import { sqliteStyle } from "https://esm.town/v/robaggio/sqliteStyle";
17import { ResultSet, sqlite } from "https://esm.town/v/std/sqlite";
18import { reloadOnSaveFetchMiddleware } from "https://esm.town/v/stevekrouse/reloadOnSave";
19import { Hono } from "npm:hono";
20import type { FC } from "npm:hono/jsx";
175});
176177export const handler = app.fetch;
178export default iframeHandler(modifyFetchHandler(passwordAuth(handler, { verifyPassword: verifyToken })));
whoIsHiringmain.tsx12 matches
61}, [state.loading, state.hasMore]);
6263const fetchStories = async () => {
64try {
65const response = await fetch("/api/stories");
66if (!response.ok) throw new Error("Failed to fetch dates");
67const data = await response.json();
68setStories(data);
70}
71catch (err) {
72console.error("Error fetching stories:", err);
73}
74};
7576const fetchComments = async (query: string, story: string, page: number) => {
77try {
78dispatch({ type: "loading", value: true });
79const response = await fetch(`/api/comments?query=${encodeURIComponent(query)}&story=${story}&page=${page}`);
80if (!response.ok) throw new Error("Failed to fetch comments");
81const data = await response.json();
82setComments(prevComments => page === 1 ? data.hits : [...prevComments, ...data.hits]);
84dispatch({ type: "loading", value: false });
85} catch (err) {
86console.error("Error fetching comments:", err);
87dispatch({ type: "loading", value: false });
88}
99dispatch({ type: "hasMore", value: true });
100dispatch({ type: "query", value: newQuery });
101fetchComments(fullQuery, state.story, 1);
102};
103104useEffect(() => {
105fetchStories();
106107const handleScroll = () => {
122: "";
123const fullQuery = `${filtersQuery} ${state.query}`;
124fetchComments(fullQuery, state.story, state.page);
125}
126}
418tags: `comment, story_${story}`,
419page: 0,
420hitsPerPage: 100, // Fetch a moderate number of comments
421});
422