Skip to content
Snippets Groups Projects
Commit 5390d3f0 authored by Louis's avatar Louis :fire:
Browse files

Support self route

parent 4d5da3b7
No related branches found
No related tags found
No related merge requests found
exports.self = async ctx => {
const user = await ctx.services.authService.getUser()
if (user) {
await user.handleIncludes(ctx.includes)
}
ctx.body = { user }
}
exports.updateSelf = async ctx => {
const user = await ctx.services.authService.getUser()
if (user) {
await user.handleIncludes(ctx.includes)
}
ctx.body = { user }
}
\ No newline at end of file
...@@ -34,6 +34,8 @@ api.post('/feature', upload.single('featured_image'), controller('api/storage', ...@@ -34,6 +34,8 @@ api.post('/feature', upload.single('featured_image'), controller('api/storage',
api.post('/register', controller('api/auth', 'register')) api.post('/register', controller('api/auth', 'register'))
api.post('/login', controller('api/auth', 'login')) api.post('/login', controller('api/auth', 'login'))
api.get('/self', controller('api/user', 'self'))
module.exports = { module.exports = {
api, api,
web, web,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment