Fix wish not updating information

This commit is contained in:
grandeljay 2022-06-21 09:20:54 +02:00
parent c6a5ac7caa
commit f649855c2c

View file

@ -142,6 +142,7 @@ $(function () {
var wishlistIndex = $('.ui.dropdown.wishlists select').prop('selectedIndex') - 1; var wishlistIndex = $('.ui.dropdown.wishlists select').prop('selectedIndex') - 1;
var wishlist_user = wishlists[wishlistIndex].user; var wishlist_user = wishlists[wishlistIndex].user;
card.addClass('loading');
card.attr('data-cache', 'false'); card.attr('data-cache', 'false');
fetch('/src/api/wishes.php?wish_id=' + card.attr('data-id') + '&wishlist_user=' + wishlist_user, { fetch('/src/api/wishes.php?wish_id=' + card.attr('data-id') + '&wishlist_user=' + wishlist_user, {
@ -149,6 +150,9 @@ $(function () {
}) })
.then(handleFetchError) .then(handleFetchError)
.then(handleFetchResponse) .then(handleFetchResponse)
.then(function(response) {
card.replaceWith(response.html.replace('data-cache="true"', 'data-cache="false"'));
})
.catch(handleFetchCatch) .catch(handleFetchCatch)
.finally(function() { .finally(function() {
card.removeClass('loading'); card.removeClass('loading');