chef 3744 Posted August 31, 2020 Share Posted August 31, 2020 Does anyone else receive this error in the web app? Link to comment Share on other sites More sharing options...
chef 3744 Posted August 31, 2020 Author Share Posted August 31, 2020 (edited) I think the issue is referencing back to the button as 'this' after we declared it as the event button ('button') in the function. For some reason after 'button' is given the event data in the function, later it turns to an int with a value of '0' (see image). the current code for the function needs to change to this maybe: function onClick(e) { var button = e.target.closest('button'); //just incase the user hits the '<span>' text in the button. , id = button.getAttribute("data-id") , serverId = button.getAttribute("data-serverid") , apiClient = connectionManager.getApiClient(serverId) , likes = button.getAttribute("data-likes"); likes = "true" === likes || "false" !== likes && null, function(button, apiClient, itemId, likes, isFavorite) { return apiClient.updateFavoriteStatus(apiClient.getCurrentUserId(), itemId, !isFavorite) }(0, apiClient, id, 0, "true" === button.getAttribute("data-isfavorite")).then(function(userData) { setState(button, userData.Likes, userData.IsFavorite) }) } Still 'userdata' returns in the promise as 'undefined'. Edited August 31, 2020 by chef Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now