twitterAlertmain.tsx1 match
19: Math.floor((Date.now() - 2 * 24 * 60 * 60 * 1000) / 1000);
2021// Fetch and log tweets
22const response = await socialDataSearch(`${query} since_time:${timeFrame}`);
23console.log("Response from socialDataSearch:", response);
cerebras_codermain.tsx1 match
182183try {
184const response = await fetch("/", {
185method: "POST",
186body: JSON.stringify({
tactfulCoffeeOctopusmain.tsx1 match
19: Math.floor((Date.now() - 2 * 24 * 60 * 60 * 1000) / 1000);
2021// Fetch and log tweets
22const response = await socialDataSearch(`${query} since_time:${timeFrame}`);
23console.log("Response from socialDataSearch:", response);
ReactStaticmain.tsx1 match
67export type RequestHandler = (request: Request) => Promise<Response>;
8export type DataFetcher<T> = (request: Request) => Promise<T>;
910// export type DataRequest<T> = Request & { data: T };
ReactStaticREADME.md2 matches
66```
6768### Fetch data on the server to set initial props
697072// example middleware
73async function getInitialProps (req: Request, res: Response, next) {
74// fetch data or do async work to pass as props to the component
75req.data = {
76hello: "props",
ReactStream_migratedmain.tsx4 matches
67export type RequestHandler = (request: Request) => Promise<Response>;
8export type DataFetcher<T> = (request: Request) => Promise<T>;
910// export type DataRequest<T> = Request & { data: T };
132return api(req);
133};
134const deprecatedGetInitiaProps = (getProps: DataFetcher<any>): Middleware => async (req, res, next) => {
135if (!getProps) return next();
136const data = await getProps(req);
144/** DEPRECATED: Optional API request handler for all non-GET methods */
145api?: RequestHandler;
146/** DEPRECATED: data fetcher to set initial props based on request */
147getInitialProps?: DataFetcher<any>;
148}
myBookmarkManagermain.tsx11 matches
87// ----------------- Effects -----------------
88useEffect(() => {
89fetchSavedBookmarks();
90}, []);
91180181// ----------------- Data Loading -----------------
182async function fetchSavedBookmarks() {
183const response = await fetch("/api/bookmarks");
184const data = await response.json();
185setAllSavedBookmarks(data);
232e.preventDefault();
233if (editBookmarkId === null) {
234const response = await fetch("/api/bookmarks", {
235method: "POST",
236headers: { "Content-Type": "application/json" },
248if (response.ok) {
249closeAddBookmarkOverlay();
250fetchSavedBookmarks();
251}
252} else {
253const response = await fetch(`/api/bookmarks/${editBookmarkId}`, {
254method: "PUT",
255headers: { "Content-Type": "application/json" },
267if (response.ok) {
268closeAddBookmarkOverlay();
269fetchSavedBookmarks();
270}
271}
274// ----------------- Export / Import -----------------
275async function saveAllBookmarks() {
276const response = await fetch("/api/bookmarks/export");
277const bookmarkData = await response.text(); // Get as text instead of blob
278const blob = new Blob([bookmarkData], { type: "application/json" });
297try {
298const loadedBookmarks = JSON.parse(fileContent);
299const response = await fetch("/api/bookmarks/import", {
300method: "POST",
301headers: { "Content-Type": "application/json" },
304if (response.ok) {
305alert("Bookmarks loaded successfully");
306fetchSavedBookmarks();
307} else {
308alert("Error loading bookmarks");
15131514export default async function handleRequest(request) {
1515return app.fetch(request);
1516}
1517
twitterAlertmain.tsx1 match
20: Math.floor((Date.now() - 2 * 24 * 60 * 60 * 1000) / 1000);
2122// Fetch and log tweets
23const response = await socialDataSearch(`${query} since_time:${timeFrame}`);
24console.log("Response from socialDataSearch:", response);
chatApplicationmain.tsx18 matches
30
31try {
32const response = await fetch(`/${mode}`, {
33method: "POST",
34headers: { "Content-Type": "application/json" },
41setIsLoggedIn(true);
42setError("");
43await fetchContacts();
44await fetchMessages();
45await fetchFiles();
46} else {
47setError(data.message || "Authentication failed");
53};
5455const fetchContacts = async () => {
56try {
57const response = await fetch("/contacts");
58if (response.ok) {
59const data = await response.json();
64}
65} catch (error) {
66console.error("Failed to fetch contacts", error);
67}
68};
6970const fetchMessages = async () => {
71try {
72const response = await fetch("/messages");
73if (response.ok) {
74const data = await response.json();
76}
77} catch (error) {
78console.error("Failed to fetch messages", error);
79}
80};
8182const fetchFiles = async () => {
83try {
84const response = await fetch("/files");
85if (response.ok) {
86const data = await response.json();
88}
89} catch (error) {
90console.error("Failed to fetch files", error);
91}
92};
9798try {
99const response = await fetch("/message", {
100method: "POST",
101headers: { "Content-Type": "application/json" },
109if (response.ok) {
110setNewMessage("");
111await fetchMessages();
112}
113} catch (error) {
141142try {
143const response = await fetch("/upload", {
144method: "POST",
145body: formData
147148if (response.ok) {
149await fetchFiles();
150fileInputRef.current.value = null;
151}
157const downloadFile = async (fileId) => {
158try {
159const response = await fetch(`/download/${fileId}`);
160if (response.ok) {
161const blob = await response.blob();
umbrellaRemindermain.tsx2 matches
1import { email } from "https://esm.town/v/std/email?v=9";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3import { nominatimSearch } from "https://esm.town/v/stevekrouse/nominatimSearch";
4import { weatherGovGrid } from "https://esm.town/v/stevekrouse/weatherGovGrid";
14lon,
15});
16let { properties: { periods } } = await fetchJSON(
17grid.forecastHourly,
18);