ensl_gathers/lib/user/helper.mjs

24 lines
482 B
JavaScript
Raw Permalink Normal View History

import User from "./user.mjs";
2015-08-18 11:40:48 +00:00
export const getRandomUser = callback => {
2020-07-21 18:30:01 +00:00
const id = Math.floor(Math.random() * 5000) + 1;
User.find(id, function (error, user) {
if (error) return getRandomUser(callback);
return callback(error, user);
})
};
export const getFixedUser = (id, callback) => {
2015-08-28 14:00:14 +00:00
User.find(id, function (error, user) {
if (error) return getRandomUser(callback);
return callback(error, user);
})
2015-08-18 11:40:48 +00:00
};
export default {
2020-07-21 18:30:01 +00:00
getRandomUser,
getFixedUser
2015-08-18 11:40:48 +00:00
};