Allow query params for /me

This commit is contained in:
Alexandre Bodin 2022-06-01 19:11:18 +02:00
parent 291e2b6835
commit 64852e9cda
2 changed files with 5 additions and 4 deletions

View File

@ -94,7 +94,6 @@ module.exports = {
if (!user) { if (!user) {
throw new NotFoundError(`User not found`); throw new NotFoundError(`User not found`);
} }
await validateUpdateUserBody(ctx.request.body); await validateUpdateUserBody(ctx.request.body);
@ -186,12 +185,15 @@ module.exports = {
* @return {Object|Array} * @return {Object|Array}
*/ */
async me(ctx) { async me(ctx) {
const user = ctx.state.user; const authUser = ctx.state.user;
const { query } = ctx;
if (!user) { if (!authUser) {
return ctx.unauthorized(); return ctx.unauthorized();
} }
const user = await getService('user').fetch(authUser.id, query);
ctx.body = await sanitizeOutput(user, ctx); ctx.body = await sanitizeOutput(user, ctx);
}, },
}; };

View File

@ -14,7 +14,6 @@ module.exports = [
path: '/users', path: '/users',
handler: 'user.find', handler: 'user.find',
config: { config: {
auth: {},
prefix: '', prefix: '',
}, },
}, },