Skip to content

Commit

Permalink
fix: update total after favorite
Browse files Browse the repository at this point in the history
  • Loading branch information
jakowenko committed Jun 22, 2023
1 parent bb7899f commit d041335
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions frontend/src/views/GalleryView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ const toggleSelectAll = () => {
updateFavoritesDefault();
};
const updateTotal = async () => {
const { data } = await ApiService.get('gallery');
total.value = data.total;
};
const favoriteSelected = async () => {
favoritesDefault.value = !favoritesDefault.value;
galleries.value.forEach((gallery: Gallery) => {
Expand All @@ -219,16 +224,12 @@ const favoriteSelected = async () => {
});
try {
await ApiService.patch('image', { ids: selected.value.images, favorite: favoritesDefault.value });
await updateTotal();
} catch (error) {
emitter.emit('error', error);
}
};
const updateTotal = async () => {
const { data } = await ApiService.get('gallery');
total.value = data.total;
};
const deleteSelected = async () => {
confirm.require({
header: 'Confirmation',
Expand Down

0 comments on commit d041335

Please sign in to comment.