refresh gear overview (#10971)

* refresh bought seasonal gear

* just "subscribe" to the _v change instead of returning the value

* subscribe in vue instead of lib
This commit is contained in:
negue
2019-02-10 19:32:14 +01:00
committed by Matteo Pagliazzi
parent 4d1b239231
commit 844d3fbf37
2 changed files with 10 additions and 22 deletions

View File

@@ -388,7 +388,9 @@
},
seasonal () {
// vue subscriptions, don't remove
let backgroundUpdate = this.backgroundUpdate; // eslint-disable-line
const myUserVersion = this.user._v; // eslint-disable-line
let seasonal = shops.getSeasonalShop(this.user);

View File

@@ -85,30 +85,16 @@ function removePinnedGearByClass (user) {
}
function removePinnedGearAddPossibleNewOnes (user, itemPath, newItemKey) {
let currentPinnedItems = selectGearToPin(user);
let removeAndAddAllItems = false;
for (let item of currentPinnedItems) {
let itemInfo = getItemInfo(user, 'marketGear', item);
if (itemInfo.path === itemPath) {
removeAndAddAllItems = true;
break;
}
}
removeItemByPath(user, itemPath);
if (removeAndAddAllItems) {
// an item of the users current "new" gear was bought
// remove the old pinned gear items and add the new gear back
removePinnedGearByClass(user);
user.items.gear.owned[newItemKey] = true;
addPinnedGearByClass(user);
} else {
// just change the new gear to owned
user.items.gear.owned[newItemKey] = true;
}
// an item of the users current "new" gear was bought
// remove the old pinned gear items and add the new gear back
removePinnedGearByClass(user);
user.items.gear.owned[newItemKey] = true;
addPinnedGearByClass(user);
// update the version, so that vue can refresh the seasonal shop
user._v++;
}
/**