mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
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:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user