Typescript support

This commit is contained in:
rocketdebris 2026-05-27 08:47:53 -04:00
parent 354175ff2f
commit 0712a629a9
5 changed files with 40 additions and 7 deletions

21
app/api/picsum.ts Normal file
View file

@ -0,0 +1,21 @@
export interface PicsumData {
id: number,
author: string,
width: number,
height: number,
url: string,
download_url: string
}
export async function getPicsumData() {
try {
const response = await fetch('https://picsum.photos/v2/list');
if (!response.ok) {
throw new Error('Picsum API unavailable.');
}
const data: PicsumData[] = await response.json();
return data;
} catch (error) {
console.error("Could not fetch data:", error);
}
}