embed-servicesmax-cron.tsx3 matches
1const script = `
2export default {
3async fetch(request, env, ctx) {
4const url = new URL(request.url);
5url.host = "embed-hono.lime4042.workers.dev";
6console.log(url)
7const r = await fetch(url,request);
8return new Response((r).body,r);
9},
19files.append("uuid", uuid);
20files.append("token", key);
21const upload = await fetch(
22`https://temptemp-workers.web.val.run/pushCode?uuid=${uuid}&token=${key}`,
23{
4243try {
44const response = await fetch("/ask", {
45method: "POST",
46body: JSON.stringify({ question }),
23const [paymentMethodFilter, setPaymentMethodFilter] = useState<PaymentMethodFilter>(null);
2425// Fetch sales and payment data
26const fetchSalesData = async (startDate: Date, endDate: Date) => {
27setIsLoading(true);
28setError(null);
32const dateTo = endDate.toISOString().split('T')[0];
3334// Fetch both data sets in parallel
35const [salesResponse, paymentsResponse] = await Promise.all([
36getSaleWaiters(dateFrom, dateTo),
3940if (salesResponse && paymentsResponse) {
41console.log('Fetched sales data:', salesResponse.length, 'records');
42console.log('Fetched payment data:', paymentsResponse.length, 'records');
43
44setSalesData(salesResponse);
49}
50} catch (error) {
51setError('Failed to fetch sales data. Please try again.');
52console.error('Fetch error:', error);
53} finally {
54setIsLoading(false);
130error,
131paymentMethodFilter,
132fetchSalesData,
133filterByCashPayment,
134filterByBankPayment,
144error,
145paymentMethodFilter,
146fetchSalesData,
147filterByCashPayment,
148filterByBankPayment,
174const startDate = new Date();
175startDate.setDate(startDate.getDate() - 6);
176fetchSalesData(startDate, endDate);
177}, []);
178197<View className='mb-6'>
198<DateRangeSelector
199onDateRangeChange={fetchSalesData}
200additionalButtons={paymentMethodButtons}
201/>
cerebras_coderindex.ts1 match
181182try {
183const response = await fetch("/", {
184method: "POST",
185body: JSON.stringify({
plantprofileindex.ts1 match
2728// Export the app for HTTP val
29export default app.fetch;
plantprofileApp.tsx10 matches
25const [isEditing, setIsEditing] = useState(false);
2627// Fetch all plants on component mount
28useEffect(() => {
29fetchPlants();
30}, []);
3132const fetchPlants = async () => {
33try {
34setIsLoading(true);
35const response = await fetch("/api/plants");
36const data = await response.json();
37
39setPlants(data.data || []);
40} else {
41setError(data.error || "Failed to fetch plants");
42}
43} catch (err) {
52try {
53setIsLoading(true);
54const response = await fetch(`/api/plants/${id}`);
55const data = await response.json();
56
58setSelectedPlant(data.data);
59} else {
60setError(data.error || "Failed to fetch plant details");
61}
62} catch (err) {
71try {
72setIsLoading(true);
73const response = await fetch("/api/plants", {
74method: "POST",
75headers: {
99try {
100setIsLoading(true);
101const response = await fetch(`/api/plants/${id}`, {
102method: "PUT",
103headers: {
131try {
132setIsLoading(true);
133const response = await fetch(`/api/plants/${id}`, {
134method: "DELETE",
135});
plantprofileplants.ts4 matches
17return c.json({ success: true, data: profiles });
18} catch (error) {
19console.error("Error fetching plant profiles:", error);
20return c.json({ success: false, error: "Failed to fetch plant profiles" }, 500);
21}
22});
37return c.json({ success: true, data: profile });
38} catch (error) {
39console.error("Error fetching plant profile:", error);
40return c.json({ success: false, error: "Failed to fetch plant profile" }, 500);
41}
42});
FirstProjectindex.ts1 match
4445// Export the Hono app
46export default app.fetch;
FirstProjectindex.js21 matches
55};
5657// Fetch job listings
58const fetchJobs = async () => {
59try {
60const response = await fetch('/api/jobs');
61if (!response.ok) throw new Error('Failed to fetch jobs');
62
63const jobs = await response.json();
81`).join('');
82} catch (error) {
83console.error('Error fetching jobs:', error);
84jobListings.innerHTML = '<p class="text-red-500">Failed to load jobs. Please try again later.</p>';
85}
104};
105
106const response = await fetch('/api/jobs', {
107method: 'POST',
108headers: {
119// Reset form and refresh job listings
120jobForm.reset();
121await fetchJobs();
122
123// Show success message
132});
133134// Fetch chat messages
135const fetchChatMessages = async () => {
136try {
137const response = await fetch('/api/chat');
138if (!response.ok) throw new Error('Failed to fetch chat messages');
139
140const messages = await response.json();
166chatMessages.scrollTop = chatMessages.scrollHeight;
167} catch (error) {
168console.error('Error fetching chat messages:', error);
169chatMessages.innerHTML = '<p class="text-red-500">Failed to load messages. Please try again later.</p>';
170}
188document.getElementById('message').focus();
189
190// Fetch messages and start polling
191fetchChatMessages();
192startPolling();
193});
202
203try {
204const response = await fetch('/api/chat', {
205method: 'POST',
206headers: {
218}
219
220// Clear input and fetch new messages
221messageInput.value = '';
222await fetchChatMessages();
223} catch (error) {
224console.error('Error sending message:', error);
231if (pollingInterval) clearInterval(pollingInterval);
232
233pollingInterval = setInterval(fetchChatMessages, 3000);
234};
235243const init = async () => {
244setViewSourceLink();
245await fetchJobs();
246
247// If on chat tab and username is set, fetch messages and start polling
248if (currentUsername && !chatContent.classList.contains('hidden')) {
249await fetchChatMessages();
250startPolling();
251}
FirstProjectchat.ts2 matches
12return c.json(messages);
13} catch (error) {
14console.error("Error fetching chat messages:", error);
15return c.json({ error: "Failed to fetch chat messages" }, 500);
16}
17});