Make "want read" button work

This commit is contained in:
2025-11-06 15:53:24 +01:00
parent 6bfd3ae2da
commit a8f83db83f
14 changed files with 268 additions and 100 deletions

View File

@@ -5,7 +5,7 @@ const baseUrl = "http://localhost:8080"
export function getImagePathOrDefault(path) {
return (path == "" || typeof path === 'undefined') ?
"../defaultbook.png" : "http://localhost:8080" + path;
"../defaultbook.png" : baseUrl + path;
}
function useFetch(url) {
@@ -45,12 +45,16 @@ export function postBook(book) {
return genericPayloadCall('/book', book.value, 'POST')
}
export async function putReadBook(bookId) {
return putBookUpdate(bookId, {read: true})
export async function putReadBook(bookId, payload) {
return genericPayloadCall('/book/' + bookId + "/read", payload, 'PUT')
}
export async function putBookUpdate(bookId, payload) {
return genericPayloadCall('/book/' + bookId, payload, 'PUT')
export async function putWantReadBook(bookId, payload) {
return genericPayloadCall('/book/' + bookId + "/wantread", payload, 'PUT')
}
export async function putRateBook(bookId, payload) {
return genericPayloadCall('/book/' + bookId + "/rate", payload, 'PUT')
}
export function postLogin(user) {