add logout api

This commit is contained in:
Jay 2018-08-21 22:49:24 +08:00
parent 54e0daf198
commit eea74a7239

View File

@ -55,6 +55,11 @@ r.post('/login', koaBody(), async (c, n) => {
c.obj = resObject('Success') c.obj = resObject('Success')
}) })
r.post('/logout', async (c, n) => {
c.session = null
c.obj = resObject('Success')
})
r.get('/session', checkSession, async (c, n) => { r.get('/session', checkSession, async (c, n) => {
c.obj = resObject('Success', { c.obj = resObject('Success', {
user: c.state.loginUser user: c.state.loginUser