mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-18 17:54:10 +00:00
Fix: reassign object for items.pets to trigger change in vue view
This commit is contained in:
parent
9cbdf0df42
commit
3e476c4f52
5 changed files with 20 additions and 5 deletions
|
|
@ -47,7 +47,10 @@ export default function purchaseHourglass (user, req = {}, analytics, quantity =
|
|||
user.purchased.plan.consecutive.trinkets -= 1;
|
||||
|
||||
if (type === 'pets') {
|
||||
user.items.pets[key] = 5;
|
||||
user.items.pets = {
|
||||
...user.items.pets,
|
||||
[key]: 5,
|
||||
};
|
||||
if (user.markModified) user.markModified('items.pets');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,10 @@ import {
|
|||
import errorMessage from '../libs/errorMessage';
|
||||
|
||||
function evolve (user, pet, req) {
|
||||
user.items.pets[pet.key] = -1;
|
||||
user.items.pets = {
|
||||
...user.items.pets,
|
||||
[pet.key]: -1,
|
||||
};
|
||||
user.items.mounts[pet.key] = true;
|
||||
|
||||
if (user.markModified) {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,10 @@ export default function hatch (user, req = {}) {
|
|||
throw new NotAuthorized(i18n.t('messageAlreadyPet', req.language));
|
||||
}
|
||||
|
||||
user.items.pets[pet] = 5;
|
||||
user.items.pets = {
|
||||
...user.items.pets,
|
||||
[pet]: 5,
|
||||
};
|
||||
user.items.eggs[egg] -= 1;
|
||||
user.items.hatchingPotions[hatchingPotion] -= 1;
|
||||
if (user.markModified) {
|
||||
|
|
|
|||
|
|
@ -60,7 +60,10 @@ export default function releaseBoth (user, req = {}) {
|
|||
giveMountMasterAchievement = false;
|
||||
}
|
||||
|
||||
user.items.pets[animal] = 0;
|
||||
user.items.pets = {
|
||||
...user.items.pets,
|
||||
[animal]: 0,
|
||||
};
|
||||
user.items.mounts[animal] = null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,10 @@ export default function releasePets (user, req = {}, analytics) {
|
|||
if (!user.items.pets[pet]) {
|
||||
giveBeastMasterAchievement = false;
|
||||
}
|
||||
user.items.pets[pet] = 0;
|
||||
user.items.pets = {
|
||||
...user.items.pets,
|
||||
[pet]: 0,
|
||||
};
|
||||
}
|
||||
|
||||
if (user.markModified) user.markModified('items.pets');
|
||||
|
|
|
|||
Loading…
Reference in a new issue