Fix server crash when trying to log out and already logged out
This commit is contained in:
parent
f6396649b5
commit
fa2a958e73
|
@ -141,7 +141,9 @@ exports.resetUpdate = async ctx => {
|
|||
}
|
||||
|
||||
exports.logout = async ctx => {
|
||||
await platformLogout({ ctx, userId: ctx.user._id })
|
||||
if (ctx.user && ctx.user._id) {
|
||||
await platformLogout({ ctx, userId: ctx.user._id })
|
||||
}
|
||||
ctx.body = { message: "User logged out." }
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue