Fix: reassign object for user.items.hatchingPotions to trigger change in vue view

This commit is contained in:
Xaz16
2019-12-15 22:09:07 +03:00
parent 8b780eaf0d
commit 0f755ab80d
3 changed files with 125 additions and 31 deletions

View File

@@ -48,7 +48,11 @@ export default function hatch (user, req = {}) {
...user.items.eggs,
[egg]: Number.isInteger(user.items.eggs) ? user.items.eggs - 1 : 0,
};
user.items.hatchingPotions[hatchingPotion] -= 1;
user.items.hatchingPotions = {
...user.items.hatchingPotions,
[hatchingPotion]:
Number.isInteger(user.items.hatchingPotion) ? user.items.hatchingPotion - 1 : 0,
};
if (user.markModified) {
user.markModified('items.pets');
user.markModified('items.eggs');