mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 06:37:23 +01:00
Inventory: fixes / layout (#11948)
Co-authored-by: Sabe Jones <sabrecat@gmail.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { authWithHeaders } from '../../middlewares/auth';
|
||||
import * as userLib from '../../libs/user';
|
||||
import { verifyDisplayName } from '../../libs/user/validation';
|
||||
import common from '../../../common';
|
||||
|
||||
const api = {};
|
||||
|
||||
@@ -244,4 +245,38 @@ api.verifyDisplayName = {
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* @api {post} /api/v4/user/unequip/:type Unequip all items by type
|
||||
* @apiName UserUnEquipByType
|
||||
* @apiGroup User
|
||||
*
|
||||
* @apiParam (Path) {String="pet-mount-background","costume","equipped"} type The type of items
|
||||
* to unequip.
|
||||
*
|
||||
* @apiParamExample {URL} Example-URL
|
||||
* https://habitica.com/api/v4/user/unequip/equipped
|
||||
*
|
||||
* @apiSuccess {Object} data user.items
|
||||
* @apiSuccess {String} message Optional success message for unequipping an items
|
||||
*
|
||||
* @apiSuccessExample {json} Example return:
|
||||
* {
|
||||
* "success": true,
|
||||
* "data": {---DATA TRUNCATED---},
|
||||
* "message": "Battle Gear unequipped.
|
||||
* }
|
||||
*
|
||||
*/
|
||||
api.unequip = {
|
||||
method: 'POST',
|
||||
middlewares: [authWithHeaders()],
|
||||
url: '/user/unequip/:type',
|
||||
async handler (req, res) {
|
||||
const { user } = res.locals;
|
||||
const equipRes = common.ops.unEquipByType(user, req);
|
||||
await user.save();
|
||||
res.respond(200, ...equipRes);
|
||||
},
|
||||
};
|
||||
|
||||
export default api;
|
||||
|
||||
Reference in New Issue
Block a user