fix: wish details

This commit is contained in:
grandeljay 2023-09-07 16:26:17 +02:00
parent cfe30781a9
commit bccd9356cf
3 changed files with 9 additions and 1 deletions

View file

@ -142,7 +142,12 @@ switch ($_SERVER['REQUEST_METHOD']) {
$wishlist = Wishlist::getFromHash($_GET['wishlist_hash']); $wishlist = Wishlist::getFromHash($_GET['wishlist_hash']);
if ($wishlist instanceof Wishlist) { if ($wishlist instanceof Wishlist) {
$response['results'] = $wishlist; $response['results'] = array(
'id' => $wishlist->getId(),
'hash' => $wishlist->getHash(),
'userId' => $wishlist->getUserId(),
);
;
} else { } else {
http_response_code(404); http_response_code(404);
} }

View file

@ -55,6 +55,8 @@ $(function () {
'onShow' : function() { 'onShow' : function() {
var user_is_current = wishlist && wishlist.userId === parseInt($('[name="user-id"]').val()); var user_is_current = wishlist && wishlist.userId === parseInt($('[name="user-id"]').val());
console.log('user_is_current', user_is_current);
if (user_is_current) { if (user_is_current) {
$('.ui.button.wish-fulfil').remove(); $('.ui.button.wish-fulfil').remove();
} else { } else {

View file

@ -41,6 +41,7 @@ $(function() {
.then(handleFetchResponse) .then(handleFetchResponse)
.then(function(response) { .then(function(response) {
wishlist = response.results; wishlist = response.results;
console.log(wishlist);
}); });
} }