Files
habitica/website/client/store/actions/common.js
T
Keith Holliday 9c9b67aa9d Keys kennel fixes (#9848)
* Show keys to pets immediately

* Ensured keys to pets dissapear after use

* Added resdirect to stable after purchase

* Added mount check and updated keys to mounts and to both

* Added api calls

* Added check for beastmaster progress

* Added mount check for release mounts. Added pets and mount check to release both

* Added actions

* Added catch to common tests

* Added beast count and reload

* Removed extra console log
2018-03-02 15:30:11 -06:00

34 lines
977 B
JavaScript

import axios from 'axios';
import equipOp from 'common/script/ops/equip';
import hatchOp from 'common/script/ops/hatch';
import feedOp from 'common/script/ops/feed';
export function equip (store, params) {
const user = store.state.user.data;
equipOp(user, {params});
axios
.post(`/api/v3/user/equip/${params.type}/${params.key}`);
// TODO
// .then((res) => console.log('equip', res))
// .catch((err) => console.error('equip', err));
}
export function hatch (store, params) {
const user = store.state.user.data;
hatchOp(user, {params});
axios
.post(`/api/v3/user/hatch/${params.egg}/${params.hatchingPotion}`);
// TODO
// .then((res) => console.log('equip', res))
// .catch((err) => console.error('equip', err));
}
export async function feed (store, params) {
const user = store.state.user.data;
feedOp(user, {params});
const response = await axios
.post(`/api/v3/user/feed/${params.pet}/${params.food}`);
return response.data;
}