Start reading cancel read: move logic to backend
This commit is contained in:
@@ -72,7 +72,6 @@ async function onStartReadIconClick() {
|
||||
}
|
||||
if (data.value.read) {
|
||||
data.value.read = false
|
||||
putUnreadBook(props.id)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -86,17 +86,12 @@ async function onUserBookStartRead() {
|
||||
|
||||
async function userBookStartRead() {
|
||||
const res = await putStartRead(props.id)
|
||||
if (!res.ok) {
|
||||
res.json().then((json) => (error.value = json))
|
||||
return
|
||||
}
|
||||
const resp = await putUnreadBook(props.id)
|
||||
if (resp.ok) {
|
||||
if (res.ok) {
|
||||
currentStartReadDate.value = today
|
||||
isRead.value = false
|
||||
isWantRead.value = false
|
||||
} else {
|
||||
resp.json().then((json) => (error.value = json))
|
||||
res.json().then((json) => (error.value = json))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user