20 lines
587 B
TypeScript
20 lines
587 B
TypeScript
import axios from 'axios';
|
|
import { lakesConfig } from './scripts/lakesConfig';
|
|
|
|
async function testOpenMeteo() {
|
|
const lipno = lakesConfig.find(l => l.id.startsWith('VLL1'));
|
|
if (!lipno) return;
|
|
const lat = lipno.coords[0];
|
|
const lon = lipno.coords[1];
|
|
const url = `https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${lon}¤t=temperature_2m,precipitation`;
|
|
console.log('Fetching from:', url);
|
|
try {
|
|
const response = await axios.get(url);
|
|
console.log(response.data.current);
|
|
} catch (e) {
|
|
console.error(e.message);
|
|
}
|
|
}
|
|
|
|
testOpenMeteo();
|