From a5c743d563595e858ac285e9cb95a00c22922c0f Mon Sep 17 00:00:00 2001 From: grandeljay Date: Fri, 8 Sep 2023 21:20:20 +0200 Subject: [PATCH] fix: potential race condition --- src/assets/js/wishlist.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/assets/js/wishlist.js b/src/assets/js/wishlist.js index c9b9ddb9..fe0264c0 100644 --- a/src/assets/js/wishlist.js +++ b/src/assets/js/wishlist.js @@ -33,15 +33,16 @@ $(function() { } /** - * Get wishlist by hash + * Get wishlist by Id */ if (!wishlist && wishthis.$_GET.hash) { - fetch('/api/wishlists/' + wishthis.$_GET.hash, { method: 'GET' }) + var wishlistId = $('.wishlist-cards[data-wishlist]').attr('data-wishlist'); + + fetch('/api/wishlists/' + wishlistId, { method: 'GET' }) .then(handleFetchError) .then(handleFetchResponse) .then(function(response) { wishlist = response.results; - console.log(wishlist); }); }