diff --git a/apps/assets/templates/assets/user_asset_list.html b/apps/assets/templates/assets/user_asset_list.html index 9d3853480..fa2c9830c 100644 --- a/apps/assets/templates/assets/user_asset_list.html +++ b/apps/assets/templates/assets/user_asset_list.html @@ -104,6 +104,7 @@ $(document).ready(function () { body: JSON.stringify({asset: assetId}), flash_message: false, success: function (data) { + favoriteAssets.push(assetId); var btn = disfavorBtnTmpl.replace("ID", assetId); $this.replaceWith(btn) } @@ -117,6 +118,10 @@ $(document).ready(function () { method: "DELETE", flash_message: false, success: function (data) { + var index = favoriteAssets.indexOf(assetId); + if (index !== '-1'){ + favoriteAssets.splice(index, 1); + } var btn = favorBtnTmpl.replace("ID", assetId); $this.replaceWith(btn) }