mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-07-16 08:54:47 +02:00
Update:Remove toast for mark as finished #718
This commit is contained in:
parent
953bde5a42
commit
5a953464ab
7 changed files with 41 additions and 116 deletions
|
@ -469,25 +469,6 @@ export default {
|
||||||
editClick() {
|
editClick() {
|
||||||
this.$emit('edit', this.libraryItem)
|
this.$emit('edit', this.libraryItem)
|
||||||
},
|
},
|
||||||
toggleFinished() {
|
|
||||||
var updatePayload = {
|
|
||||||
isFinished: !this.itemIsFinished
|
|
||||||
}
|
|
||||||
this.isProcessingReadUpdate = true
|
|
||||||
var toast = this.$toast || this.$nuxt.$toast
|
|
||||||
var axios = this.$axios || this.$nuxt.$axios
|
|
||||||
axios
|
|
||||||
.$patch(`/api/me/progress/${this.libraryItemId}`, updatePayload)
|
|
||||||
.then(() => {
|
|
||||||
this.isProcessingReadUpdate = false
|
|
||||||
toast.success(`Item marked as ${updatePayload.isFinished ? 'Finished' : 'Not Finished'}`)
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.error('Failed', error)
|
|
||||||
this.isProcessingReadUpdate = false
|
|
||||||
toast.error(`Failed to mark as ${updatePayload.isFinished ? 'Finished' : 'Not Finished'}`)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
rescan() {
|
rescan() {
|
||||||
this.rescanning = true
|
this.rescanning = true
|
||||||
this.$axios
|
this.$axios
|
||||||
|
|
|
@ -349,25 +349,6 @@ export default {
|
||||||
editClick() {
|
editClick() {
|
||||||
this.$emit('edit', this.libraryItem)
|
this.$emit('edit', this.libraryItem)
|
||||||
},
|
},
|
||||||
toggleFinished() {
|
|
||||||
var updatePayload = {
|
|
||||||
isFinished: !this.itemIsFinished
|
|
||||||
}
|
|
||||||
this.isProcessingReadUpdate = true
|
|
||||||
var toast = this.$toast || this.$nuxt.$toast
|
|
||||||
var axios = this.$axios || this.$nuxt.$axios
|
|
||||||
axios
|
|
||||||
.$patch(`/api/me/progress/${this.libraryItemId}`, updatePayload)
|
|
||||||
.then(() => {
|
|
||||||
this.isProcessingReadUpdate = false
|
|
||||||
toast.success(`Item marked as ${updatePayload.isFinished ? 'Finished' : 'Not Finished'}`)
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.error('Failed', error)
|
|
||||||
this.isProcessingReadUpdate = false
|
|
||||||
toast.error(`Failed to mark as ${updatePayload.isFinished ? 'Finished' : 'Not Finished'}`)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
rescan() {
|
rescan() {
|
||||||
this.rescanning = true
|
this.rescanning = true
|
||||||
this.$axios
|
this.$axios
|
||||||
|
|
|
@ -316,7 +316,7 @@ export default {
|
||||||
if (this.touchstartTime && Date.now() - this.touchstartTime < 250) {
|
if (this.touchstartTime && Date.now() - this.touchstartTime < 250) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
console.log('touchstart', e)
|
|
||||||
this.touchstartX = e.touches[0].screenX
|
this.touchstartX = e.touches[0].screenX
|
||||||
this.touchstartY = e.touches[0].screenY
|
this.touchstartY = e.touches[0].screenY
|
||||||
this.touchstartTime = Date.now()
|
this.touchstartTime = Date.now()
|
||||||
|
@ -326,7 +326,7 @@ export default {
|
||||||
if (this.touchIdentifier !== e.changedTouches[0].identifier) {
|
if (this.touchIdentifier !== e.changedTouches[0].identifier) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
console.log('touchend', e)
|
|
||||||
this.touchendX = e.changedTouches[0].screenX
|
this.touchendX = e.changedTouches[0].screenX
|
||||||
this.touchendY = e.changedTouches[0].screenY
|
this.touchendY = e.changedTouches[0].screenY
|
||||||
this.handleGesture()
|
this.handleGesture()
|
||||||
|
|
|
@ -265,45 +265,37 @@ export default {
|
||||||
},
|
},
|
||||||
async toggleFinished() {
|
async toggleFinished() {
|
||||||
await this.$hapticsImpact()
|
await this.$hapticsImpact()
|
||||||
|
|
||||||
this.isProcessingReadUpdate = true
|
this.isProcessingReadUpdate = true
|
||||||
if (this.isLocal || this.localEpisode) {
|
if (this.isLocal || this.localEpisode) {
|
||||||
var isFinished = !this.userIsFinished
|
const isFinished = !this.userIsFinished
|
||||||
var localLibraryItemId = this.isLocal ? this.libraryItemId : this.localLibraryItemId
|
const localLibraryItemId = this.isLocal ? this.libraryItemId : this.localLibraryItemId
|
||||||
var localEpisodeId = this.isLocal ? this.episode.id : this.localEpisode.id
|
const localEpisodeId = this.isLocal ? this.episode.id : this.localEpisode.id
|
||||||
var payload = await this.$db.updateLocalMediaProgressFinished({ localLibraryItemId, localEpisodeId, isFinished })
|
const payload = await this.$db.updateLocalMediaProgressFinished({ localLibraryItemId, localEpisodeId, isFinished })
|
||||||
console.log('toggleFinished payload', JSON.stringify(payload))
|
console.log('toggleFinished payload', JSON.stringify(payload))
|
||||||
if (!payload || payload.error) {
|
if (payload?.error) {
|
||||||
var errorMsg = payload ? payload.error : 'Unknown error'
|
this.$toast.error(payload?.error || 'Unknown error')
|
||||||
this.$toast.error(errorMsg)
|
|
||||||
} else {
|
} else {
|
||||||
var localMediaProgress = payload.localMediaProgress
|
const localMediaProgress = payload.localMediaProgress
|
||||||
console.log('toggleFinished localMediaProgress', JSON.stringify(localMediaProgress))
|
console.log('toggleFinished localMediaProgress', JSON.stringify(localMediaProgress))
|
||||||
if (localMediaProgress) {
|
if (localMediaProgress) {
|
||||||
this.$store.commit('globals/updateLocalMediaProgress', localMediaProgress)
|
this.$store.commit('globals/updateLocalMediaProgress', localMediaProgress)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (payload.server) {
|
|
||||||
this.$toast.success(`Local & Server Item marked as ${isFinished ? 'Finished' : 'Not Finished'}`)
|
|
||||||
} else {
|
|
||||||
this.$toast.success(`Local Item marked as ${isFinished ? 'Finished' : 'Not Finished'}`)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.isProcessingReadUpdate = false
|
this.isProcessingReadUpdate = false
|
||||||
} else {
|
} else {
|
||||||
var updatePayload = {
|
const updatePayload = {
|
||||||
isFinished: !this.userIsFinished
|
isFinished: !this.userIsFinished
|
||||||
}
|
}
|
||||||
this.$axios
|
this.$axios
|
||||||
.$patch(`/api/me/progress/${this.libraryItemId}/${this.episode.id}`, updatePayload)
|
.$patch(`/api/me/progress/${this.libraryItemId}/${this.episode.id}`, updatePayload)
|
||||||
.then(() => {
|
|
||||||
this.isProcessingReadUpdate = false
|
|
||||||
this.$toast.success(`Item marked as ${updatePayload.isFinished ? 'Finished' : 'Not Finished'}`)
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error('Failed', error)
|
console.error('Failed', error)
|
||||||
this.isProcessingReadUpdate = false
|
|
||||||
this.$toast.error(`Failed to mark as ${updatePayload.isFinished ? 'Finished' : 'Not Finished'}`)
|
this.$toast.error(`Failed to mark as ${updatePayload.isFinished ? 'Finished' : 'Not Finished'}`)
|
||||||
})
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.isProcessingReadUpdate = false
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -271,45 +271,37 @@ export default {
|
||||||
},
|
},
|
||||||
async toggleFinished() {
|
async toggleFinished() {
|
||||||
await this.$hapticsImpact()
|
await this.$hapticsImpact()
|
||||||
|
|
||||||
this.isProcessingReadUpdate = true
|
this.isProcessingReadUpdate = true
|
||||||
if (this.isLocal || this.localEpisode) {
|
if (this.isLocal || this.localEpisode) {
|
||||||
var isFinished = !this.userIsFinished
|
const isFinished = !this.userIsFinished
|
||||||
var localLibraryItemId = this.isLocal ? this.libraryItemId : this.localLibraryItemId
|
const localLibraryItemId = this.isLocal ? this.libraryItemId : this.localLibraryItemId
|
||||||
var localEpisodeId = this.isLocal ? this.episode.id : this.localEpisode.id
|
const localEpisodeId = this.isLocal ? this.episode.id : this.localEpisode.id
|
||||||
var payload = await this.$db.updateLocalMediaProgressFinished({ localLibraryItemId, localEpisodeId, isFinished })
|
const payload = await this.$db.updateLocalMediaProgressFinished({ localLibraryItemId, localEpisodeId, isFinished })
|
||||||
console.log('toggleFinished payload', JSON.stringify(payload))
|
console.log('toggleFinished payload', JSON.stringify(payload))
|
||||||
if (!payload || payload.error) {
|
if (payload?.error) {
|
||||||
var errorMsg = payload ? payload.error : 'Unknown error'
|
this.$toast.error(payload?.error || 'Unknown error')
|
||||||
this.$toast.error(errorMsg)
|
|
||||||
} else {
|
} else {
|
||||||
var localMediaProgress = payload.localMediaProgress
|
const localMediaProgress = payload.localMediaProgress
|
||||||
console.log('toggleFinished localMediaProgress', JSON.stringify(localMediaProgress))
|
console.log('toggleFinished localMediaProgress', JSON.stringify(localMediaProgress))
|
||||||
if (localMediaProgress) {
|
if (localMediaProgress) {
|
||||||
this.$store.commit('globals/updateLocalMediaProgress', localMediaProgress)
|
this.$store.commit('globals/updateLocalMediaProgress', localMediaProgress)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (payload.server) {
|
|
||||||
this.$toast.success(`Local & Server Item marked as ${isFinished ? 'Finished' : 'Not Finished'}`)
|
|
||||||
} else {
|
|
||||||
this.$toast.success(`Local Item marked as ${isFinished ? 'Finished' : 'Not Finished'}`)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.isProcessingReadUpdate = false
|
this.isProcessingReadUpdate = false
|
||||||
} else {
|
} else {
|
||||||
var updatePayload = {
|
const updatePayload = {
|
||||||
isFinished: !this.userIsFinished
|
isFinished: !this.userIsFinished
|
||||||
}
|
}
|
||||||
this.$axios
|
this.$axios
|
||||||
.$patch(`/api/me/progress/${this.libraryItemId}/${this.episode.id}`, updatePayload)
|
.$patch(`/api/me/progress/${this.libraryItemId}/${this.episode.id}`, updatePayload)
|
||||||
.then(() => {
|
|
||||||
this.isProcessingReadUpdate = false
|
|
||||||
this.$toast.success(`Item marked as ${updatePayload.isFinished ? 'Finished' : 'Not Finished'}`)
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error('Failed', error)
|
console.error('Failed', error)
|
||||||
this.isProcessingReadUpdate = false
|
|
||||||
this.$toast.error(`Failed to mark as ${updatePayload.isFinished ? 'Finished' : 'Not Finished'}`)
|
this.$toast.error(`Failed to mark as ${updatePayload.isFinished ? 'Finished' : 'Not Finished'}`)
|
||||||
})
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.isProcessingReadUpdate = false
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -501,32 +501,20 @@ export default {
|
||||||
const payload = await this.$db.updateLocalMediaProgressFinished({ localLibraryItemId, localEpisodeId, isFinished })
|
const payload = await this.$db.updateLocalMediaProgressFinished({ localLibraryItemId, localEpisodeId, isFinished })
|
||||||
console.log('toggleFinished payload', JSON.stringify(payload))
|
console.log('toggleFinished payload', JSON.stringify(payload))
|
||||||
|
|
||||||
if (!payload || payload.error) {
|
if (payload?.error) {
|
||||||
var errorMsg = payload ? payload.error : 'Unknown error'
|
this.$toast.error(payload?.error || 'Unknown error')
|
||||||
this.$toast.error(errorMsg)
|
|
||||||
} else {
|
} else {
|
||||||
const localMediaProgress = payload.localMediaProgress
|
const localMediaProgress = payload.localMediaProgress
|
||||||
console.log('toggleFinished localMediaProgress', JSON.stringify(localMediaProgress))
|
console.log('toggleFinished localMediaProgress', JSON.stringify(localMediaProgress))
|
||||||
if (localMediaProgress) {
|
if (localMediaProgress) {
|
||||||
this.$store.commit('globals/updateLocalMediaProgress', localMediaProgress)
|
this.$store.commit('globals/updateLocalMediaProgress', localMediaProgress)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (payload.server) {
|
|
||||||
this.$toast.success(`Local & Server Item marked as ${isFinished ? 'Finished' : 'Not Finished'}`)
|
|
||||||
} else {
|
|
||||||
this.$toast.success(`Local Item marked as ${isFinished ? 'Finished' : 'Not Finished'}`)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const updatePayload = {
|
const updatePayload = {
|
||||||
isFinished: !this.userIsFinished
|
isFinished: !this.userIsFinished
|
||||||
}
|
}
|
||||||
this.$axios
|
this.$axios.$patch(`/api/me/progress/${this.libraryItemId}/${this.episode.id}`, updatePayload).catch((error) => {
|
||||||
.$patch(`/api/me/progress/${this.libraryItemId}/${this.episode.id}`, updatePayload)
|
|
||||||
.then(() => {
|
|
||||||
this.$toast.success(`Item marked as ${updatePayload.isFinished ? 'Finished' : 'Not Finished'}`)
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.error('Failed', error)
|
console.error('Failed', error)
|
||||||
this.$toast.error(`Failed to mark as ${updatePayload.isFinished ? 'Finished' : 'Not Finished'}`)
|
this.$toast.error(`Failed to mark as ${updatePayload.isFinished ? 'Finished' : 'Not Finished'}`)
|
||||||
})
|
})
|
||||||
|
|
|
@ -751,41 +751,32 @@ export default {
|
||||||
|
|
||||||
this.isProcessingReadUpdate = true
|
this.isProcessingReadUpdate = true
|
||||||
if (this.isLocal) {
|
if (this.isLocal) {
|
||||||
var isFinished = !this.userIsFinished
|
const isFinished = !this.userIsFinished
|
||||||
var payload = await this.$db.updateLocalMediaProgressFinished({ localLibraryItemId: this.localLibraryItemId, isFinished })
|
const payload = await this.$db.updateLocalMediaProgressFinished({ localLibraryItemId: this.localLibraryItemId, isFinished })
|
||||||
console.log('toggleFinished payload', JSON.stringify(payload))
|
console.log('toggleFinished payload', JSON.stringify(payload))
|
||||||
if (!payload || payload.error) {
|
if (payload?.error) {
|
||||||
var errorMsg = payload ? payload.error : 'Unknown error'
|
this.$toast.error(payload?.error || 'Unknown error')
|
||||||
this.$toast.error(errorMsg)
|
|
||||||
} else {
|
} else {
|
||||||
var localMediaProgress = payload.localMediaProgress
|
const localMediaProgress = payload.localMediaProgress
|
||||||
console.log('toggleFinished localMediaProgress', JSON.stringify(localMediaProgress))
|
console.log('toggleFinished localMediaProgress', JSON.stringify(localMediaProgress))
|
||||||
if (localMediaProgress) {
|
if (localMediaProgress) {
|
||||||
this.$store.commit('globals/updateLocalMediaProgress', localMediaProgress)
|
this.$store.commit('globals/updateLocalMediaProgress', localMediaProgress)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (payload.server) {
|
|
||||||
this.$toast.success(`Local & Server Item marked as ${isFinished ? 'Finished' : 'Not Finished'}`)
|
|
||||||
} else {
|
|
||||||
this.$toast.success(`Local Item marked as ${isFinished ? 'Finished' : 'Not Finished'}`)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.isProcessingReadUpdate = false
|
this.isProcessingReadUpdate = false
|
||||||
} else {
|
} else {
|
||||||
var updatePayload = {
|
const updatePayload = {
|
||||||
isFinished: !this.userIsFinished
|
isFinished: !this.userIsFinished
|
||||||
}
|
}
|
||||||
this.$axios
|
this.$axios
|
||||||
.$patch(`/api/me/progress/${this.libraryItemId}`, updatePayload)
|
.$patch(`/api/me/progress/${this.libraryItemId}`, updatePayload)
|
||||||
.then(() => {
|
|
||||||
this.isProcessingReadUpdate = false
|
|
||||||
this.$toast.success(`Item marked as ${updatePayload.isFinished ? 'Finished' : 'Not Finished'}`)
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error('Failed', error)
|
console.error('Failed', error)
|
||||||
this.isProcessingReadUpdate = false
|
|
||||||
this.$toast.error(`Failed to mark as ${updatePayload.isFinished ? 'Finished' : 'Not Finished'}`)
|
this.$toast.error(`Failed to mark as ${updatePayload.isFinished ? 'Finished' : 'Not Finished'}`)
|
||||||
})
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.isProcessingReadUpdate = false
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
libraryChanged(libraryId) {
|
libraryChanged(libraryId) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue