prodigiousBrownImpalamain.tsx4 matches
3637useEffect(() => {
38async function fetchStats() {
39const response = await fetch("/dashboard-stats");
40const data = await response.json();
41setStats(data);
42}
43fetchStats();
44}, []);
45146147try {
148const response = await fetch("/", {
149method: "POST",
150body: JSON.stringify({
BestTime2postmain.tsx1 match
60
61try {
62const response = await fetch("/check-email", {
63method: "POST",
64headers: { "Content-Type": "application/json" },
captivatingPurpleTapirmain.tsx20 matches
1516useEffect(() => {
17fetchStocks();
18fetchOperations();
19}, []);
2021async function fetchStocks() {
22const response = await fetch('/stocks');
23const data = await response.json();
24setStocks(data);
25}
2627async function fetchOperations() {
28const response = await fetch('/operations');
29const data = await response.json();
30setOperations(data);
33async function addStock(e) {
34e.preventDefault();
35const response = await fetch('/stocks', {
36method: 'POST',
37headers: { 'Content-Type': 'application/json' },
38body: JSON.stringify(newStock)
39});
40await fetchStocks();
41await fetchOperations();
42setNewStock({ symbol: '', shares: 0, purchasePrice: 0, sellPrice: 0 });
43}
4445async function deleteStock(symbol: string, shares: number, purchasePrice: number) {
46const response = await fetch('/stocks', {
47method: 'DELETE',
48headers: { 'Content-Type': 'application/json' },
49body: JSON.stringify({ symbol, shares, purchasePrice })
50});
51await fetchStocks();
52await fetchOperations();
53}
5455async function updateStock(stock) {
56const response = await fetch('/stocks', {
57method: 'PUT',
58headers: { 'Content-Type': 'application/json' },
59body: JSON.stringify(stock)
60});
61await fetchStocks();
62await fetchOperations();
63setEditingStock(null);
64}
178stock.shares,
179stock.purchasePrice,
180await fetchStockPrice(stock.symbol),
181stock.sellPrice || null
182]
269}
270271// Existing fetchStockPrice function remains the same
272async function fetchStockPrice(symbol: string): Promise<number> {
273try {
274const response = await fetch(`https://query1.finance.yahoo.com/v8/finance/chart/${symbol}`);
275const data = await response.json();
276return data.chart.result[0].meta.regularMarketPrice;
277} catch {
278return 0; // Default to 0 if price can't be fetched
279}
280}
SermonGPTUImain.tsx9 matches
91const [autoScroll, setAutoScroll] = useState(true);
9293// Fetch saved sermons on component mount
94useEffect(() => {
95const fetchSermons = async () => {
96try {
97const response = await fetch(`${endpointURL}/sermons`);
98const data = await response.json();
99console.log("Fetched sermons:", data); // Debugging log
100// Ensure data is an array, even if it's empty
101setSermons(Array.isArray(data) ? data : []);
102} catch (error) {
103console.error("Failed to fetch sermons:", error);
104// Set to empty array in case of error
105setSermons([]);
107};
108109fetchSermons();
110}, []);
111169170try {
171const response = await fetch(`${endpointURL}/delete-sermon/${sermonId}`, {
172method: "DELETE",
173});
200201try {
202const res = await fetch(`${endpointURL}/save-sermon`, {
203method: "POST",
204headers: {
233234try {
235const res = await fetch(`${endpointURL}/stream`, {
236method: "POST",
237body: JSON.stringify({ question }),
legendaryVioletBovidmain.tsx4 matches
3637useEffect(() => {
38async function fetchStats() {
39const response = await fetch("/dashboard-stats");
40const data = await response.json();
41setStats(data);
42}
43fetchStats();
44}, []);
45146147try {
148const response = await fetch("/", {
149method: "POST",
150body: JSON.stringify({
notionSiteRssmain.tsx4 matches
1314try {
15// Fetch database metadata
16const databaseMetadata = await notion.databases.retrieve({
17database_id: databaseId,
18});
1920// Fetch pages from the database
21const response = await notion.databases.query({
22database_id: databaseId,
24property: "Published", // Customize based on your database schema
25checkbox: {
26equals: true, // Only fetch published pages
27},
28},
48});
49} catch (error) {
50console.error("Error fetching Notion pages:", error);
51return new Response("Error retrieving pages", { status: 500 });
52}
tweetArchiveViewermain.tsx10 matches
17const COBALT_API_URL = "https://dorsiblancoapicobalt.nulo.in";
1819async function fetchMedia(url) {
20try {
21const response = await fetch(COBALT_API_URL, {
22method: "POST",
23headers: {
53return data;
54} catch (error) {
55console.error("Error fetching media:", error);
56return null;
57}
58}
5960async function fetchTweets(dumpFile) {
61try {
62const response = await fetch(BASE_URL + dumpFile);
63if (!response.ok) {
64throw new Error(`HTTP error! status: ${response.status}`);
91return { tweets, totalProcessed };
92} catch (error) {
93console.error("Error fetching or parsing data:", error);
94throw new Error("Error al cargar los tweets. Por favor, intentá de nuevo más tarde.");
95}
134const media = await Promise.all(tweet.mediaUrls.map(async (media) => {
135if (media.type === "video") {
136const fetchedMedia = await fetchMedia(media.url);
137return fetchedMedia ? { ...media, fetchedUrl: fetchedMedia.url } : media;
138}
139return media;
171<div key={index} className="video-container">
172<video controls poster={media.preview} className="tweet-video" onLoadedMetadata={onMediaLoad}>
173<source src={media.fetchedUrl || media.url} type="video/mp4" />
174Your browser does not support the video tag.
175</video>
235setError(null);
236try {
237const { tweets: newTweets, totalProcessed: newTotalProcessed } = await fetchTweets(selectedDump.file);
238setTweets(newTweets);
239setFilteredTweets(newTweets);
valreadmegeneratormain.tsx1 match
4243try {
44const response = await fetch(`/generate-readme/${user}/${val}`);
4546if (!response.ok) {
valreadmegeneratorREADME.md2 matches
29302. **Generate:**
31- Click on 'Generate README' and watch as the application swiftly fetches and processes the Val code to create a Markdown README.
32333. **Copy and Share:**
42- **TailwindCSS:** For styling the application.
43- **Deno:** The server-side environment.
44- **ValTown SDK:** Integrated to fetch Val details.
45- **OpenAI GPT-4:** To generate natural language README content.
46- **JavaScript Modules (ESM):** For seamless module imports.
10event.preventDefault();
11const formData = new FormData(event.target);
12const response = await fetch("/generate", {
13method: "POST",
14body: formData,