mirror of
https://github.com/jellyfin/jellyfin-vue.git
synced 2024-12-03 11:41:09 +00:00
Merge pull request #757 from jellyfin/improve-like
refactor(like button): update data before requesting like/unlike from server
This commit is contained in:
commit
c1ec56a120
@ -59,23 +59,27 @@ export default Vue.extend({
|
||||
|
||||
try {
|
||||
if (!this.isFavorite) {
|
||||
await this.$nuxt.$api.userLibrary.markFavoriteItem({
|
||||
userId: this.$auth.user.Id,
|
||||
itemId: this.item.Id
|
||||
});
|
||||
this.isFavorite = true;
|
||||
} else {
|
||||
await this.$nuxt.$api.userLibrary.unmarkFavoriteItem({
|
||||
|
||||
await this.$api.userLibrary.markFavoriteItem({
|
||||
userId: this.$auth.user.Id,
|
||||
itemId: this.item.Id
|
||||
});
|
||||
} else {
|
||||
this.isFavorite = false;
|
||||
|
||||
await this.$api.userLibrary.unmarkFavoriteItem({
|
||||
userId: this.$auth.user.Id,
|
||||
itemId: this.item.Id
|
||||
});
|
||||
}
|
||||
} catch {
|
||||
this.pushSnackbarMessage({
|
||||
message: this.$t('unableToToggleLike'),
|
||||
color: 'error'
|
||||
});
|
||||
|
||||
this.isFavorite = !this.isFavorite;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user