Jump to content

Web App - Anyone else recieve this "userData.Likes" error.

Recommended Posts


Does anyone else receive this error in the web app?





Share this post

Link to post
Share on other sites
Posted (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 by chef

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...