mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
start upgrading eslint
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import content from '../content/index';
|
||||
import i18n from '../i18n';
|
||||
import get from 'lodash/get';
|
||||
import pick from 'lodash/pick';
|
||||
import content from '../content/index';
|
||||
import i18n from '../i18n';
|
||||
import splitWhitespace from '../libs/splitWhitespace';
|
||||
import {
|
||||
NotFound,
|
||||
@@ -13,9 +13,9 @@ import {
|
||||
const ACCEPTEDTYPES = ['eggs', 'hatchingPotions', 'food'];
|
||||
|
||||
export default function sell (user, req = {}) {
|
||||
let key = get(req.params, 'key');
|
||||
let type = get(req.params, 'type');
|
||||
let amount = get(req.query, 'amount', 1);
|
||||
const key = get(req.params, 'key');
|
||||
const type = get(req.params, 'type');
|
||||
const amount = get(req.query, 'amount', 1);
|
||||
|
||||
if (amount < 0) {
|
||||
throw new BadRequest(i18n.t('positiveAmountRequired', req.language));
|
||||
@@ -30,17 +30,17 @@ export default function sell (user, req = {}) {
|
||||
}
|
||||
|
||||
if (ACCEPTEDTYPES.indexOf(type) === -1) {
|
||||
throw new NotAuthorized(i18n.t('typeNotSellable', {acceptedTypes: ACCEPTEDTYPES.join(', ')}, req.language));
|
||||
throw new NotAuthorized(i18n.t('typeNotSellable', { acceptedTypes: ACCEPTEDTYPES.join(', ') }, req.language));
|
||||
}
|
||||
|
||||
if (!user.items[type][key]) {
|
||||
throw new NotFound(i18n.t('userItemsKeyNotFound', {type}, req.language));
|
||||
throw new NotFound(i18n.t('userItemsKeyNotFound', { type }, req.language));
|
||||
}
|
||||
|
||||
let currentAmount = user.items[type][key];
|
||||
const currentAmount = user.items[type][key];
|
||||
|
||||
if (amount > currentAmount) {
|
||||
throw new NotFound(i18n.t('userItemsNotEnough', {type}, req.language));
|
||||
throw new NotFound(i18n.t('userItemsNotEnough', { type }, req.language));
|
||||
}
|
||||
|
||||
if (type === 'food' && key === 'Saddle') {
|
||||
|
||||
Reference in New Issue
Block a user