10e.preventDefault();
11try {
12const response = await fetch("/login", {
13method: "POST",
14headers: { "Content-Type": "application/json" },
58const [tagInput, setTagInput] = useState("");
5960// Fetch previous customer details when email changes
61useEffect(() => {
62const fetchCustomerDetails = async () => {
63if (!email) return;
6465try {
66const response = await fetch(`/get-customer-details?email=${encodeURIComponent(email)}`);
67if (response.ok) {
68const customerDetails = await response.json();
73}
74} catch (error) {
75console.error("Error fetching customer details:", error);
76}
77};
7879fetchCustomerDetails();
80}, [email]);
81138e.preventDefault();
139try {
140const response = await fetch("/add-interaction", {
141method: "POST",
142headers: { "Content-Type": "application/json" },
250const [uniqueCustomerCount, setUniqueCustomerCount] = useState(0);
251252const fetchUniqueCustomerCount = async () => {
253try {
254const response = await fetch("/get-unique-customer-count");
255const data = await response.json();
256setUniqueCustomerCount(data.count);
257} catch (error) {
258console.error("Error fetching unique customer count:", error);
259}
260};
261262useEffect(() => {
263fetchInteractions();
264fetchUniqueCustomerCount();
265}, [currentPage, selectedTags]);
266281const handleDeleteInteraction = async (id) => {
282try {
283const response = await fetch("/delete-interaction", {
284method: "DELETE",
285headers: { "Content-Type": "application/json" },
288289if (response.ok) {
290fetchInteractions();
291}
292} catch (error) {
303};
304305const fetchInteractions = async () => {
306try {
307const response = await fetch(`/get-interactions?page=${currentPage}`);
308const data = await response.json();
309336if (selectedTags.length > 0) {
337// Need to get total count of filtered interactions from server
338const filteredCountResponse = await fetch(`/get-filtered-count?tags=${selectedTags.join(",")}`);
339const filteredCountData = await filteredCountResponse.json();
340setTotalInteractions(filteredCountData.count);
343}
344} catch (error) {
345console.error("Error fetching interactions:", error);
346}
347};
348349useEffect(() => {
350fetchInteractions();
351}, [currentPage, selectedTags]);
352481const checkAuth = async () => {
482try {
483const response = await fetch("/check-auth");
484const data = await response.json();
485setIsAuthenticated(data.authenticated);
isMyWebsiteDownmain.tsx2 matches
14start = performance.now();
15try {
16const res = await fetch(url);
17end = performance.now();
18status = res.status;
25} catch (e) {
26end = performance.now();
27reason = `couldn't fetch: ${e}`;
28ok = false;
29console.log(`Website down (${url}): ${reason} (${end - start}ms)`);
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> {
OpenTownieindex1 match
2627try {
28const response = await fetch("/", {
29method: "POST",
30headers: { "authorization": "Bearer " + bearerToken },
OpenTowniegenerateCode1 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({
ThumbMakermain.tsx1 match
394app.get('/main.js', serve(js, 'text/javascript'));
395396export default app.fetch;
azureDinosaurmain.tsx2 matches
1import { fetchFile, toBlobURL } from "https://esm.sh/@ffmpeg/util";
2import { FFmpeg } from "https://maxm-emeraldox.web.val.run/@ffmpeg/ffmpeg";
38wasmURL: `https://esm.sh/@ffmpeg/core@0.12.6/dist/umd/ffmpeg-core.wasm`,
9});
10console.log(FFmpeg, fetchFile, toBlobURL);
createWebsitemain.tsx4 matches
68e.preventDefault();
69try {
70const response = await fetch(`${API_BASE_URL}/login`, {
71method: 'POST',
72headers: { 'Content-Type': 'application/json' },
121122try {
123const response = await fetch(`${API_BASE_URL}/signup`, {
124method: 'POST',
125headers: { 'Content-Type': 'application/json' },
181182try {
183const response = await fetch(`${API_BASE_URL}/upload`, {
184method: 'POST',
185body: formData
215216try {
217const response = await fetch(`${API_BASE_URL}/chat`, {
218method: 'POST',
219headers: { 'Content-Type': 'application/json' },
sqliteAdminDashboardmain.tsx15 matches
1516useEffect(() => {
17fetchTables();
18}, []);
1920const fetchTables = async () => {
21try {
22const response = await fetch("/tables");
23const data = await response.json();
24setTables(data);
25} catch (err) {
26setError("Failed to fetch tables");
27}
28};
2930const fetchTableData = async (tableName) => {
31try {
32const dataResponse = await fetch(`/table/${tableName}`);
33const data = await dataResponse.json();
34setTableData(data);
3536const schemaResponse = await fetch(`/schema/${tableName}`);
37const schema = await schemaResponse.json();
38setTableSchema(schema);
46setNewRow(emptyRow);
47} catch (err) {
48setError(`Failed to fetch data for table ${tableName}`);
49}
50};
56const handleSave = async (index) => {
57try {
58const response = await fetch(`/update/${selectedTable}`, {
59method: "POST",
60headers: {
67}
68setEditingRow(null);
69await fetchTableData(selectedTable);
70} catch (err) {
71setError(`Failed to update row: ${err.message}`);
85const handleAddRow = async () => {
86try {
87const response = await fetch(`/insert/${selectedTable}`, {
88method: "POST",
89headers: {
95throw new Error("Failed to add new row");
96}
97await fetchTableData(selectedTable);
98// Reset newRow to empty values
99const emptyRow = Object.keys(newRow).reduce((acc, key) => {
109const handleDeleteTable = async () => {
110try {
111const response = await fetch(`/table/${selectedTable}`, {
112method: "DELETE",
113});
121setTableData([]);
122setTableSchema([]);
123await fetchTables();
124} catch (err) {
125setError(`Failed to delete table: ${err.message}`);
135<li
136key={table}
137onClick={() => fetchTableData(table)}
138className={selectedTable === table ? "active" : ""}
139>
competentOlivePeacockmain.tsx9 matches
5354useEffect(() => {
55fetchContent();
56}, []);
5758const fetchContent = async () => {
59try {
60const response = await fetch("/api/content");
61const data = await response.json();
62if (data.records) {
63setContent(data.records);
64} else {
65throw new Error("Failed to fetch content");
66}
67setLoading(false);
68} catch (error) {
69console.error("Error fetching content:", error);
70setLoading(false);
71}
99const analyzeContent = async (item: AirtableRecord) => {
100try {
101const response = await fetch("/api/analyze", {
102method: "POST",
103headers: {
265266try {
267const response = await fetch(airtableUrl, {
268headers: {
269"Authorization": `Bearer ${apiToken}`,
279return new Response(JSON.stringify(data), { headers });
280} catch (error) {
281console.error("Error fetching Airtable data:", error);
282return new Response(JSON.stringify({ error: "Error fetching data from Airtable" }), {
283status: 500,
284headers,