Add helpers and types for BFF API

This commit is contained in:
Hannah dagemark 2026-08-14 22:37:42 +02:00
commit 9dbd93a430
5 changed files with 89 additions and 0 deletions

18
lib/api/helpers/users.ts Normal file
View file

@ -0,0 +1,18 @@
export async function getUsers() {
const response = await fetch("/api/users");
if (!response.ok) {
throw new Error(`Response status: ${response.status}`);
}
return response.json();
}
export async function getUser(id: number) {
const response = await fetch(`/api/users/${id}`);
if (!response.ok) {
throw new Error(`Response status: ${response.status}`);
}
return response.json();
}