mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-07-14 10:12:21 +00:00
api:send 200 if not enough gp, no need to error
This commit is contained in:
parent
2644e575ee
commit
e2943178f4
1 changed files with 3 additions and 2 deletions
|
|
@ -234,8 +234,9 @@ api.buy = (req, res, next) ->
|
|||
return res.json 400, err: ":type must be in one of: 'weapon', 'armor', 'head', 'shield'"
|
||||
hasEnough = true
|
||||
done = ->
|
||||
return res.json 400, err: "Not enough GP" unless hasEnough
|
||||
req.habit.result = data: req.habit.user.get("items")
|
||||
req.habit.result = if hasEnough
|
||||
data: req.habit.user.get("items")
|
||||
else {data: {err: "Not enough GP"}}
|
||||
next()
|
||||
misc.batchTxn req.getModel(), (uObj, paths) ->
|
||||
hasEnough = items.buyItem(uObj, type, {paths})
|
||||
|
|
|
|||
Loading…
Reference in a new issue