cerebras_codermain.tsx1 match
182183try {
184const response = await fetch("/", {
185method: "POST",
186body: JSON.stringify({
reactRouter7server.tsx1 match
5if (url.pathname == "/js/entry.client.js") {
6const moduleUrl = new URL("./entry.client.tsx", import.meta.url);
7return fetch(moduleUrl);
8}
9return handler(request);
reactRouter7layout.client.ts2 matches
3export async function loader({ request }: LoaderFunctionArgs) {
4let url = new URL(request.url);
5let res = await fetch(url, {
6headers: {
7Accept: "application/json",
15let url = new URL(request.url);
16// call the server action
17let res = await fetch(url, {
18method: "POST",
19body: new URLSearchParams(await request.formData()),
12* @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
13* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
14* @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
15* @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
16* @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
YoutubeSearchAppmain.tsx2 matches
23e.preventDefault();
24try {
25const response = await fetch(`/search?q=${encodeURIComponent(searchQuery)}`);
26const data = await response.json();
274344try {
45const response = await fetch("/save-video", {
46method: "POST",
47headers: {
gitHubSyncmain.tsx3 matches
82if (!code) return c.text("No code provided", 400);
8384const tokenResponse = await fetch("https://github.com/login/oauth/access_token", {
85method: "POST",
86headers: {
97const { access_token } = await tokenResponse.json();
9899const userResponse = await fetch("https://api.github.com/user", {
100headers: {
101"Authorization": `token ${access_token}`,
302}
303304export default app.fetch;
305306interface CommitOptions {
wordRangeFindermain.tsx2 matches
1011useEffect(() => {
12fetch('/words')
13.then(response => response.json())
14.then(data => setWords(data));
7778if (url.pathname === '/words') {
79const corpusResponse = await fetch('https://gist.githubusercontent.com/daemondevin/df09befaf533c380743bc2c378863f0c/raw/b79b0628e79766326cdd61cc52a7222b8e5ad49a/5-letter-words.txt');
80const corpusText = await corpusResponse.text();
81const words = corpusText.split('\n').filter(word => word.trim().length === 5);
YouTubeSaveAppmain.tsx15 matches
30const checkLoginStatus = async () => {
31try {
32const response = await fetch('/check-login');
33const data = await response.json();
34if (data.loggedIn) {
35setUser(data.user);
36fetchSavedVideos();
37}
38} catch (err) {
43const searchVideos = async () => {
44try {
45const response = await fetch(`/search?q=${encodeURIComponent(query)}`);
46const data = await response.json();
47setVideos(data.items || []);
48setError(null);
49} catch (err) {
50setError("Failed to fetch videos");
51setVideos([]);
52}
56e.preventDefault();
57try {
58const response = await fetch('/login', {
59method: 'POST',
60headers: { 'Content-Type': 'application/json' },
65setUser(data.user);
66setView('search');
67fetchSavedVideos();
68} else {
69setError(data.message);
77e.preventDefault();
78try {
79const response = await fetch('/register', {
80method: 'POST',
81headers: { 'Content-Type': 'application/json' },
96const logout = async () => {
97try {
98await fetch('/logout', { method: 'POST' });
99setUser(null);
100setView('login');
106const saveVideo = async (video) => {
107try {
108const response = await fetch('/save-video', {
109method: 'POST',
110headers: { 'Content-Type': 'application/json' },
113const data = await response.json();
114if (data.success) {
115fetchSavedVideos();
116}
117} catch (err) {
120};
121122const fetchSavedVideos = async () => {
123try {
124const response = await fetch('/saved-videos');
125const data = await response.json();
126setSavedVideos(data.videos || []);
127} catch (err) {
128setError("Failed to fetch saved videos");
129}
130};
421}
422423// Fetch Saved Videos
424if (url.pathname === '/saved-videos') {
425// Note: This is a mock implementation. In a real app, you'd get the user ID from a session
449450try {
451const apiResponse = await fetch(
452`https://youtube.googleapis.com/youtube/v3/search?part=snippet&maxResults=12&q=${encodeURIComponent(query)}&type=video&key=AIzaSyA6J525ONAprqQ2yJcjir6NiqlB8mLzMls`
453);
1112useEffect(() => {
13fetch("/api/posts")
14.then(res => res.json())
15.then(setPosts);
1617fetch("/api/me")
18.then(res => res.json())
19.then(setUser);
38formData.append("caption", postCaption);
3940const response = await fetch("/api/posts", {
41method: "POST",
42body: formData,
5253const likePost = async (postId) => {
54const response = await fetch(`/api/posts/${postId}/like`, { method: "POST" });
55const updatedPost = await response.json();
56setPosts(posts.map(post => post.id === postId ? updatedPost : post));
5859const login = async (username, password) => {
60const response = await fetch("/api/login", {
61method: "POST",
62body: JSON.stringify({ username, password }),
6768const logout = async () => {
69await fetch("/api/logout", { method: "POST" });
70setUser(null);
71};
248}
249250// Fetch posts endpoint
251if (url.pathname === "/api/posts" && request.method === "GET") {
252const posts = await sqlite.execute(`
verseOfTheDayAppmain.tsx7 matches
24const [errorMessage, setErrorMessage] = useState<string>("");
2526const fetchRandomVerse = async () => {
27setStatus("loading");
28setErrorMessage("");
46: endpoint.url;
4748const response = await fetch(url, {
49mode: "cors", // Enable CORS
50headers: {
76setStatus("error");
77setErrorMessage(
78`Failed to fetch verse after ${maxAttempts} attempts. ${
79error instanceof Error ? error.message : "Unknown error"
80}. Please try again later.`,
85};
8687// Auto-fetch verse on component mount
88useEffect(() => {
89fetchRandomVerse();
90}, []);
91217</div>
218<button
219onClick={fetchRandomVerse}
220disabled={status === "loading"}
221style={{
261262try {
263const response = await fetch("https://bible-api.com/?random=true&translation=asv");
264const data = await response.json();
265