whoIsHiringmain.tsx12 matches
61}, [state.loading, state.hasMore]);
6263const fetchStories = async () => {
64try {
65const response = await fetch("/api/stories");
66if (!response.ok) throw new Error("Failed to fetch dates");
67const data = await response.json();
68setStories(data);
70}
71catch (err) {
72console.error("Error fetching stories:", err);
73}
74};
7576const fetchComments = async (query: string, story: string, page: number) => {
77try {
78dispatch({ type: "loading", value: true });
79const response = await fetch(`/api/comments?query=${encodeURIComponent(query)}&story=${story}&page=${page}`);
80if (!response.ok) throw new Error("Failed to fetch comments");
81const data = await response.json();
82setComments(prevComments => page === 1 ? data.hits : [...prevComments, ...data.hits]);
84dispatch({ type: "loading", value: false });
85} catch (err) {
86console.error("Error fetching comments:", err);
87dispatch({ type: "loading", value: false });
88}
99dispatch({ type: "hasMore", value: true });
100dispatch({ type: "query", value: newQuery });
101fetchComments(fullQuery, state.story, 1);
102};
103104useEffect(() => {
105fetchStories();
106107const handleScroll = () => {
122: "";
123const fullQuery = `${filtersQuery} ${state.query}`;
124fetchComments(fullQuery, state.story, state.page);
125}
126}
391tags: `comment, story_${story}`,
392page: 0,
393hitsPerPage: 100, // Fetch a moderate number of comments
394});
395
67async function checkNewVulnerabilities() {
8const response = await fetch(KEV_URL);
9const data = await response.json();
10const currentVulnerabilities = new Set(data.vulnerabilities.map(v => v.cveID));
knownExploitedVulnsEndpointmain.tsx2 matches
1export default async function server(request: Request): Promise<Response> {
2try {
3const response = await fetch("https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json");
4if (!response.ok) {
5throw new Error(`HTTP error! status: ${response.status}`);
23} catch (error) {
24console.error("Error:", error);
25return new Response(JSON.stringify({ error: "Failed to fetch or process vulnerabilities data" }), {
26status: 500,
27headers: {
cisaKEVToRSSmain.tsx2 matches
70export async function handler(req: Request): Promise<Response> {
71try {
72const response = await fetch(CISA_JSON_URL);
7374if (!response.ok) {
75throw new Error(`Failed to fetch data: ${response.status} ${response.statusText}`);
76}
77
67}
6869console.log(`Fetching contributions for ${username}`);
70try {
71let vals;
81}
8283console.log(`Fetched ${vals.length} contributions`);
84const contributionData = processVals(vals, useVersions);
85console.log(`Processed ${contributionData.length} contributions`);
282}
283284export default (typeof Deno !== "undefined" && Deno.env.get("valtown")) ? app.fetch : app;
resyGetMatchingSlotmain.tsx2 matches
1import { fetch } from "https://esm.town/v/std/fetch";
2import { resyPublicAPIKey } from "https://esm.town/v/vtdocs/resyPublicAPIKey";
322const startTime = new Date(`${day} ${start}`);
23const endTime = new Date(`${day} ${end}`);
24const slotsRes = await fetch(
25`https://api.resy.com/4/find?lat=0&long=0&day=${day}&party_size=${partySize}&venue_id=${venueId}`,
26{
1import { fetch } from "https://esm.town/v/std/fetch";
2import { resyPublicAPIKey } from "https://esm.town/v/vtdocs/resyPublicAPIKey";
39}[];
10}> => {
11const authRes = await fetch("https://api.resy.com/3/auth/password", {
12"headers": {
13"authorization": `ResyAPI api_key="${resyPublicAPIKey}"`,
grievingYellowAspmain.tsx2 matches
10const start = performance.now();
11try {
12await fetch(url);
13const end = performance.now();
14return end - start;
15} catch (error) {
16console.error("Error fetching URL:", error);
17return null;
18}
1import { fetch } from "https://esm.town/v/std/fetch";
23export default async function server(req: Request): Promise<Response> {
7for (const urlMatch of cssString.matchAll(urlRegex)) {
8const originalUrl = urlMatch[1];
9const response = await fetch(originalUrl);
10const data = new Uint8Array(await response.arrayBuffer());
11result = result.replace(
29let fontCss = "";
30try {
31const r = await fetch(
32"https://fonts.googleapis.com/css2?family=" +
33encodeURIComponent("IBM Plex Sans:wght@600") +
37);
38if (!r.ok)
39throw new Error("Failed to fetch font CSS");
40fontCss = await inlineUrls(await r.text());
41}
42catch (e) {
43console.error("Error fetching font CSS:", e);
44}
45
dateme_migratedmain.tsx2 matches
1import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
2import { form } from "https://esm.town/v/stevekrouse/date_me_form";
3import browse from "https://esm.town/v/stevekrouse/dateme_browse";
13app.get("/faq", faq);
14app.get("/rss.xml", c => dateMeRSS(c.req as unknown as Request));
15export default modifyFetchHandler(app.fetch, {
16style: `@media (max-width: 500px) {
17.github-fork-ribbon {