mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
[#1468] hatchingPotion purchasing fix. also some temp hacks to get the UI to update
This commit is contained in:
@@ -18,12 +18,15 @@ habitrpg.controller("MarketCtrl", ['$rootScope', '$scope', 'User', 'API_URL', '$
|
|||||||
var message = "Buy this " + (type == 'egg' ? 'egg' : 'hatching potion') + " with " + item.value + " of your " + gems + " Gems?"
|
var message = "Buy this " + (type == 'egg' ? 'egg' : 'hatching potion') + " with " + item.value + " of your " + gems + " Gems?"
|
||||||
|
|
||||||
if(confirm(message)){
|
if(confirm(message)){
|
||||||
var toPush = type === 'egg' ? item : item.name;
|
$http.post(API_URL + '/api/v1/market/buy?type=' + type, item)
|
||||||
$http.post(API_URL + '/api/v1/market/buy?type=' + type, toPush)
|
|
||||||
.success(function(data){
|
.success(function(data){
|
||||||
User.user.balance = data.balance;
|
// don't know what's going on, but trying to work with the returned data (a) isn't updating the ui, (b) isnt'
|
||||||
store.push(toPush);
|
// stickign between refreshes until a force-refresh is called (user._v--).
|
||||||
//$sc¡ope.items = data.items.eggs; // FIXME this isn't updating the UI
|
User.user._v--;
|
||||||
|
User.log({});
|
||||||
|
//User.user.balance = data.balance;
|
||||||
|
store.push(type === 'egg' ? item : item.name);
|
||||||
|
//$scope.items = data.items.eggs; // FIXME this isn't updating the UI
|
||||||
}).error(function(data){
|
}).error(function(data){
|
||||||
alert(data);
|
alert(data);
|
||||||
console.error(data);
|
console.error(data);
|
||||||
|
|||||||
Reference in New Issue
Block a user