finish most of redux retrofit

This commit is contained in:
41666 2017-12-10 04:26:28 -06:00
parent 52cb96baa3
commit 5899268b22
7 changed files with 64 additions and 17 deletions

View file

@ -33,6 +33,11 @@ module.exports = (R, $) => {
})
R.get('/api/auth/user', async ctx => {
if (ctx.session.accessToken === undefined) {
ctx.body = { err: 'not_logged_in' }
ctx.status = 401
}
const user = await $.discord.getUser(ctx.session.accessToken)
ctx.session.userId = user.id
ctx.session.avatarHash = user.avatar