acme-customsindex.tsx4 matches
6869async createWebCall(params) {
70const response = await fetch(\`\${this.baseUrl}/call/web\`, {
71method: 'POST',
72headers: {
1180if (!this.transcriptText || this.transcriptText.startsWith('Awaiting connection')) return;
1181try {
1182const res = await fetch("/extract-data", {
1183method: "POST",
1184headers: { "Content-Type": "application/json" },
1277});
12781279// Export app.fetch for Val Town, otherwise export app
1280export default (typeof Deno !== "undefined" && Deno.env.get("valtown"))
1281? app.fetch
1282: app;
cerebras_coderindex.ts1 match
181182try {
183const response = await fetch("/", {
184method: "POST",
185body: JSON.stringify({
untitled-7712index.ts2 matches
35let html = await readFile("/frontend/index.html", import.meta.url);
36
37// Fetch initial data
38const jobs = await getJobs();
39const messages = await getMessages(20); // Get last 20 messages
119120// Export the Hono app
121export default app.fetch;
untitled-7712index.js17 matches
49renderMessages();
50} else {
51fetchJobs();
52fetchMessages();
53}
547879// Set up polling for new messages
80setInterval(fetchMessages, 5000);
81}
8283// API calls
84async function fetchJobs() {
85try {
86const response = await fetch('/api/jobs');
87if (!response.ok) throw new Error('Failed to fetch jobs');
88
89state.jobs = await response.json();
90renderJobs();
91} catch (error) {
92console.error('Error fetching jobs:', error);
93elements.jobsContainer.innerHTML = '<p class="text-red-500">Error loading jobs. Please try again.</p>';
94}
95}
9697async function fetchMessages(limit = 50) {
98try {
99const response = await fetch(`/api/messages?limit=${limit}`);
100if (!response.ok) throw new Error('Failed to fetch messages');
101
102const newMessages = await response.json();
108}
109} catch (error) {
110console.error('Error fetching messages:', error);
111if (elements.chatMessages.children.length === 0) {
112elements.chatMessages.innerHTML = '<p class="text-red-500">Error loading messages. Please try again.</p>';
117async function createUser(username) {
118try {
119const response = await fetch('/api/users', {
120method: 'POST',
121headers: { 'Content-Type': 'application/json' },
136async function createJob(jobData) {
137try {
138const response = await fetch('/api/jobs', {
139method: 'POST',
140headers: { 'Content-Type': 'application/json' },
155async function sendMessage(content) {
156try {
157const response = await fetch('/api/messages', {
158method: 'POST',
159headers: { 'Content-Type': 'application/json' },
169}
170
171// Fetch latest messages after sending
172fetchMessages();
173return await response.json();
174} catch (error) {
225elements.jobForm.reset();
226toggleModal(elements.jobModal, false);
227fetchJobs();
228
229// Announce the new job in chat
pass-genpassword-generator.ts5 matches
1export default async function (req: Request) {
2// Fetch a password from dinopass.com on the server side to avoid CORS issues
3let dinoPassword = "";
4try {
5const response = await fetch('https://www.dinopass.com/password/simple');
6dinoPassword = await response.text();
7} catch (error) {
8console.error('Error fetching from dinopass:', error);
9dinoPassword = "quietbat76"; // Fallback example
10}
245button.innerHTML = '<span>Generating...</span>';
246
247// Fetch from our own endpoint to avoid CORS issues
248const response = await fetch(window.location.href);
249const html = await response.text();
250
14## How It Works
15161. When the "Generate Password" button is clicked, the app fetches a simple password from dinopass.com
172. It extracts two whole words from the response
183. It formats them as Word99Word! (with capitalized first letters)
untitled-2444index.ts2 matches
163} else {
164// Use the server proxy
165const response = await fetch("/api/process", {
166method: "POST",
167body: formData
727
728try {
729const response = await fetch("/api/detect-type", {
730method: "POST",
731headers: {
110}
111112const useAuthenticatedFetch = () => {
113const { getToken } = useAuth();
114116const token = await getToken();
117118return await fetch(`https://www.thegluechat.com${endpoint}`, {
119method: "POST",
120body: JSON.stringify(data),
813setIsLoading(true);
814// Reverse geocode the coordinates to get an address
815const response = await fetch(
816`https://maps.googleapis.com/maps/api/geocode/json?latlng=${position.coords.latitude},${position.coords.longitude}&key=AIzaSyAOtUMb5jLTjTVM7iKzIx2SJ3HgMKNcM7U`,
817);
1230});
12311232export default app.fetch;
createContactDetail.tsx10 matches
22const [isAddingInteraction, setIsAddingInteraction] = useState(false);
2324// Fetch interactions for this contact
25const fetchInteractions = async () => {
26if (!contact.id) return;
27
30
31try {
32const response = await fetch(`/api/contacts/${contact.id}/interactions`);
33const result = await response.json();
34
35if (!result.success) {
36throw new Error(result.error || "Failed to fetch interactions");
37}
38
40} catch (err) {
41setError(err instanceof Error ? err.message : "An unknown error occurred");
42console.error("Error fetching interactions:", err);
43} finally {
44setIsLoading(false);
48// Load interactions when contact changes
49useEffect(() => {
50fetchInteractions();
51}, [contact.id]);
5254const handleAddInteraction = async (interaction: Interaction) => {
55try {
56const response = await fetch("/api/interactions", {
57method: "POST",
58headers: { "Content-Type": "application/json" },
69}
70
71fetchInteractions();
72setIsAddingInteraction(false);
73onContactUpdated();
83
84try {
85const response = await fetch(`/api/interactions/${id}`, {
86method: "DELETE"
87});
93}
94
95fetchInteractions();
96onContactUpdated();
97} catch (err) {