karate_classesmain.tsx18 matches
9798useEffect(() => {
99fetch("/api/classes")
100.then(res => res.json())
101.then(data => {
102console.log("Fetched classes:", data);
103setClasses(data);
104})
105.catch(error => console.error("Error fetching classes:", error));
106}, []);
107132133useEffect(() => {
134console.log("Fetching class details for ID:", id);
135fetch(`/api/classes/${id}`)
136.then(res => res.json())
137.then(data => {
138console.log("Fetched class details:", data);
139setClassInfo(data);
140})
141.catch(error => console.error("Error fetching class details:", error));
142143if (email) {
144console.log("Checking registration status for email:", email);
145fetch(`/api/classes/${id}/registration?email=${email}`)
146.then(res => res.json())
147.then(data => {
148console.log("Fetched registration status:", data);
149setIsRegistered(data.registered);
150})
151.catch(error => console.error("Error fetching registration status:", error));
152}
153}, [id, email]);
156157const handleRegister = () => {
158fetch(`/api/classes/${id}/register`, {
159method: "POST",
160headers: { "Content-Type": "application/json" },
174175const handleCancel = () => {
176fetch(`/api/classes/${id}/cancel`, {
177method: "POST",
178headers: { "Content-Type": "application/json" },
193const handleDelete = () => {
194if (window.confirm("Are you sure you want to delete this class?")) {
195fetch(`/api/classes/${id}`, { method: "DELETE" })
196.then(() => navigate("/classes"))
197.catch(error => console.error("Error deleting class:", error));
266useEffect(() => {
267if (id) {
268fetch(`/api/classes/${id}`)
269.then(res => res.json())
270.then(data => {
275});
276})
277.catch(error => console.error("Error fetching class data:", error));
278}
279}, [id]);
291const url = id ? `/api/classes/${id}` : "/api/classes";
292293fetch(url, {
294method,
295headers: { "Content-Type": "application/json" },
415const emailList = emails.split(/[\s,]+/).filter(email => email.trim() !== "");
416417fetch(`/api/classes/${id}/bulk-add`, {
418method: "POST",
419headers: { "Content-Type": "application/json" },
738739if (url.pathname.startsWith("/api")) {
740return app.fetch(request);
741}
742
Priyam28Gptmain.tsx1 match
2930try {
31const response = await fetch("/chat", {
32method: "POST",
33headers: { "Content-Type": "application/json" },
OpenTowniegenerateCode.ts1 match
2627export async function generateCodeAnthropic(messages: Message[]): Promise<ValResponse | null> {
28const system = await (await fetch(`${import.meta.url.split("/").slice(0, -1).join("/")}/system_prompt.txt`)).text();
2930const openai = new OpenAI({
cerebras_codermain.tsx1 match
182183try {
184const response = await fetch("/", {
185method: "POST",
186body: JSON.stringify({
spotifyAPImain.tsx2 matches
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
23export let spotifyAPI = ({ token, endpoint, ...params }) =>
4fetchJSON(
5`https://api.spotify.com/v1/${endpoint}${
6"method" in params && ["POST", "PUT", "DELETE"].includes(params["method"])
valtowntownmain.tsx1 match
172});
173174export default app.fetch.bind(app);
175176const css = `
52try {
53// Get access token
54const response = await fetch("https://accounts.spotify.com/api/token", {
55method: "POST",
56headers: {
OpenTownieindex.tsx1 match
2627try {
28const response = await fetch("/", {
29method: "POST",
30headers: { "authorization": "Bearer " + bearerToken },
OpenTowniesystem_prompt.txt2 matches
155* The main App component is rendered on the client.
156* No server-side-specific code should be included in the App.
157* Use fetch to communicate with the backend server portion.
158*/
159function App() {
178* Server-only code
179* Any code that is meant to run on the server should be included in the server function.
180* This can include endpoints that the client side component can send fetch requests to.
181*/
182export default async function server(request: Request): Promise<Response> {
trackESMContentmain.tsx3 matches
10const TABLE_NAME = `${KEY}_versions_v1`;
1112async function fetchContent(url: string) {
13const response = await fetch(url);
14return await response.text();
15}
3031for (const url of URLS) {
32const content = await fetchContent(url);
33const latestVersion = await sqlite.execute(
34`SELECT blob_key FROM ${TABLE_NAME} WHERE url = ? ORDER BY timestamp DESC LIMIT 1`,