add get session reponse data

This commit is contained in:
Jay
2018-08-19 20:28:52 +08:00
parent 1f326715fd
commit b2c45d19d8
2 changed files with 8 additions and 1 deletions
+5
View File
@@ -126,6 +126,11 @@ const genError = (key = null, message = null, msgCode = null) => {
const checkSession = async (c, n) => {
if (!('session' in c) || !('user' in c.session) || !('loginType' in c.session)) throw genError('NotLogin')
c.state.loginUser = {
name: c.session.loginType === 'twitich' ? c.session.user.login : c.session.user.name,
type: c.session.loginType
}
return n()
}