Skien_Stylist_UImain.tsx2 matches
4const lon = 9.6090;
56// Fetch current weather + hourly humidity & precipitation from Open-Meteo
7const url = `https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${lon}`
8+ `¤t_weather=true&hourly=relativehumidity_2m,precipitation_probability&timezone=Europe%2FOslo`;
910try {
11const res = await fetch(url);
12if (!res.ok) throw new Error(`API error: ${res.status} ${res.statusText}`);
13const data = await res.json();
Skien_Stylistmain.tsx2 matches
34try {
5const res = await fetch(apiUrl);
6if (!res.ok) throw new Error(`Failed to fetch: ${res.status} ${res.statusText}`);
78const data = await res.json();
Weather_Skienmain.tsx2 matches
5`https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${lon}¤t=temperature_2m,weathercode`;
67const res = await fetch(url);
8if (!res.ok) throw new Error("❌ Failed to fetch weather");
910const data = await res.json();
clothingRecommendermain.tsx2 matches
1import { clothingMapper } from "user:sjaskeprut/clothingMapper";
2import { weatherFetcher } from "user:sjaskeprut/weatherFetcher";
34export async function clothingRecommender() {
5const weather = await weatherFetcher();
6const clothing = clothingMapper(weather.temperature, weather.weatherCode);
7
testWeatherFetchermain.tsx2 matches
1import { weatherFetcher } from "sjaskeprut.weatherFetcher";
23export default await weatherFetcher();
weatherFetchermain.tsx2 matches
1export async function weatherFetcher() {
2const lat = 59.2096;
3const lon = 9.6090;
6`https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${lon}¤t=temperature_2m,weathercode`;
78const res = await fetch(url);
9const data = await res.json();
10
proxycorsproxy.ts4 matches
1import { fetch } from "https://esm.town/v/std/fetch";
23/**
4* A simple proxy Val that works as an HTTP handler.
5* It fetches content from a URL provided as a query parameter (`url`),
6* bypassing CORS restrictions using Val Town's proxied fetch.
7*
8* @param {Request} req The incoming HTTP request object.
24}
2526return await fetch(targetUrl);
27}
stevensDemosendDailyBrief.ts1 match
135const lastSunday = today.startOf("week").minus({ days: 1 });
136137// Fetch relevant memories using the utility function
138const memories = await getRelevantMemories();
139
stevensDemoNotebookView.tsx12 matches
67const [currentPage, setCurrentPage] = useState(1);
6869const fetchMemories = useCallback(async () => {
70setLoading(true);
71setError(null);
72try {
73const response = await fetch(API_BASE);
74if (!response.ok) {
75throw new Error(`HTTP error! status: ${response.status}`);
78setMemories(data);
79} catch (e) {
80console.error("Failed to fetch memories:", e);
81setError(e.message || "Failed to fetch memories.");
82} finally {
83setLoading(false);
8687useEffect(() => {
88fetchMemories();
89}, [fetchMemories]);
9091const handleAddMemory = async (e: React.FormEvent) => {
100101try {
102const response = await fetch(API_BASE, {
103method: "POST",
104headers: { "Content-Type": "application/json" },
112setNewMemoryTags("");
113setShowAddForm(false);
114await fetchMemories();
115} catch (e) {
116console.error("Failed to add memory:", e);
123124try {
125const response = await fetch(`${API_BASE}/${id}`, {
126method: "DELETE",
127});
129throw new Error(`HTTP error! status: ${response.status}`);
130}
131await fetchMemories();
132} catch (e) {
133console.error("Failed to delete memory:", e);
155156try {
157const response = await fetch(`${API_BASE}/${editingMemory.id}`, {
158method: "PUT",
159headers: { "Content-Type": "application/json" },
164}
165setEditingMemory(null);
166await fetchMemories();
167} catch (e) {
168console.error("Failed to update memory:", e);
stevensDemoindex.ts2 matches
135));
136137// HTTP vals expect an exported "fetch handler"
138export default app.fetch;