mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
v3 adapt v2: adapt common ops
This commit is contained in:
@@ -1,10 +1,15 @@
|
||||
import _ from 'lodash';
|
||||
import autoAllocate from '../fns/autoAllocate';
|
||||
|
||||
module.exports = function allocateNow (user) {
|
||||
module.exports = function allocateNow (user, req = {}) {
|
||||
_.times(user.stats.points, () => autoAllocate(user));
|
||||
user.stats.points = 0;
|
||||
return {
|
||||
data: _.pick(user, 'stats'),
|
||||
};
|
||||
|
||||
if (req.v2 === true) {
|
||||
return _.pick(user, 'stats');
|
||||
} else {
|
||||
return {
|
||||
data: _.pick(user, 'stats'),
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user