healthCheckmain.tsx2 matches
78useEffect(() => {
9fetch(window.location.href)
10.then(response => response.json())
11.then(data => setHealth(data))
12.catch(error => console.error('Error fetching health data:', error));
13}, []);
14
EquityCalculatormain.tsx12 matches
60// Enhanced Stock Data Service using a proxy approach
61const StockDataService = {
62async fetchStockData(ticker) {
63try {
64// Use a proxy service to fetch stock data
65const response = await fetch(`https://query1.finance.yahoo.com/v8/finance/chart/${ticker}`);
6667if (!response.ok) {
68throw new Error("Failed to fetch stock data");
69}
7072const stockInfo = data.chart.result[0];
7374// Fetch additional details
75const summaryResponse = await fetch(
76`https://query2.finance.yahoo.com/v10/finance/quoteSummary/${ticker}?modules=summaryDetail`,
77);
84};
85} catch (error) {
86console.error("Stock data fetch error:", error);
8788// Fallback mock data
128};
129130// Fetch stock data when ticker changes
131useEffect(() => {
132const fetchStockData = async () => {
133if (!stockTicker) return;
134137138try {
139const stockData = await StockDataService.fetchStockData(stockTicker);
140141if (stockData) {
144}
145} catch (err) {
146setError(err.message || "Could not fetch stock data. Please check the ticker.");
147setSharePrice("");
148setAnnualDividendPerShare("");
152};
153154fetchStockData();
155}, [stockTicker]);
156
supremeSalmonLizardmain.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)`);
11const start = performance.now();
12try {
13const res = await fetch(url);
14end = performance.now();
15status = res.status;
22} catch (e) {
23end = performance.now();
24reason = `couldn't fetch: ${e}`;
25ok = false;
26console.log(`Website down (${url}): ${reason} (${end - start}ms)`);
earthquakesmain.tsx3 matches
1import { fetch } from "https://esm.town/v/std/fetch";
2import { set } from "https://esm.town/v/std/set?v=11";
3let { earthquakes_storage } = await import("https://esm.town/v/fil/earthquakes_storage");
12import("https://cdn.jsdelivr.net/npm/linkedom@0.15/+esm").then((l) => l.parseHTML("<a>")),
13import("https://cdn.jsdelivr.net/npm/topojson@3/+esm"),
14fetch(dataUrl).then((r) => r.json()),
15fetch(worldUrl).then((r) => r.json()),
16]);
17world = topojson.presimplify(world, topojson.sphericalTriangleArea);
crmtemplatemain.tsx20 matches
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);
crmtemplatemain.tsx20 matches
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);
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);
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);
4041useEffect(() => {
42fetchTasks();
43loadUserPreferences();
44}, []);
72}
7374async function fetchTasks() {
75try {
76const response = await fetch("/get-tasks");
77const data = await response.json();
78setTaskLists(data);
79} catch (error) {
80console.error("Error fetching tasks", error);
81}
82}
8687try {
88const response = await fetch("/add-task", {
89method: "POST",
90headers: { "Content-Type": "application/json" },
107108try {
109const response = await fetch("/move-task", {
110method: "POST",
111headers: { "Content-Type": "application/json" },
125async function removeTask(taskId, column) {
126try {
127const response = await fetch("/delete-task", {
128method: "POST",
129headers: { "Content-Type": "application/json" },
142143try {
144const response = await fetch("/move-task", {
145method: "POST",
146headers: { "Content-Type": "application/json" },
174if (!editedTaskText.trim() || !taskBeingEdited) return;
175try {
176const response = await fetch("/update-task", {
177method: "POST",
178headers: { "Content-Type": "application/json" },