fix: fix quest shop to not use string addition when buying quests (#10120)

* fix: fix quest shop to not use string addition when buying quests

fixes #10115

* Fixing quest purchase quantity interpretted as a string on the server side.

* Adjusting pull-request according to comments.

* Updating according to PR comments.
This commit is contained in:
Travis
2018-03-24 09:17:23 -07:00
committed by Sabe Jones
parent dcd680c293
commit 781256c917
6 changed files with 58 additions and 3 deletions

View File

@@ -109,7 +109,9 @@ function purchaseItem (user, item, price, type, key) {
module.exports = function purchase (user, req = {}, analytics) {
let type = get(req.params, 'type');
let key = get(req.params, 'key');
let quantity = req.quantity || 1;
let quantity = req.quantity ? Number(req.quantity) : 1;
if (isNaN(quantity)) throw new BadRequest(i18n.t('invalidQuantity', req.language));
if (!type) {
throw new BadRequest(i18n.t('typeRequired', req.language));