La in dapper, och routing. fixade upp lite exempelsidor

This commit is contained in:
2025-09-09 17:15:11 +02:00
parent 8c54a120d1
commit 01e341fce0
15 changed files with 260 additions and 24 deletions

View File

@@ -0,0 +1,21 @@
import { book, author } from "../types/types";
const BibblanService = {
getBooks: async (
authorid: string | undefined = undefined
): Promise<book[]> => {
let url = "/api/bibblan/books";
if (authorid != undefined) {
url += `/author/${authorid}`;
}
const response = await fetch(url);
return response.json();
},
getAuthors: async (): Promise<author[]> => {
const response = await fetch("/api/bibblan/authors");
return response.json();
},
};
export default BibblanService;