Add special spells to Seasonal Shop API (#8138)

* WIP(shops): add spells to Seasonal API

* refactor(shops): remove superfluous if

* feat(shops): handle spell purchasing

* fix(test): proper required fields check
Also corrects a linting error.

* refactor(shops): use constants
This commit is contained in:
Sabe Jones
2016-10-13 17:53:02 -05:00
committed by GitHub
parent 3fabf3391f
commit 009ab26711
5 changed files with 53 additions and 23 deletions

View File

@@ -832,7 +832,7 @@ api.purchase = {
url: '/user/purchase/:type/:key',
async handler (req, res) {
let user = res.locals.user;
let purchaseRes = common.ops.purchase(user, req, res.analytics);
let purchaseRes = req.params.type === 'spells' ? common.ops.buySpecialSpell(user, req) : common.ops.purchase(user, req, res.analytics);
await user.save();
res.respond(200, ...purchaseRes);
},