This repository has been archived on 2024-04-29. You can view files and clone it, but cannot push or open issues or pull requests.
node-fftcg/backend/routes/user/logout.coffee

26 lines
569 B
CoffeeScript
Raw Normal View History

2019-05-07 20:15:18 +00:00
logger = (require 'logging').default 'logout'
# session storage (volatile data)
session = (require '../../session')
# fftcg.db (persistent data)
fftcgdb = (require '../../db')
module.exports =
url: '/user/logout'
method: 'POST'
handler: (request, reply) ->
new Promise (resolve) ->
session.destroy request.body.session ? ""
.then ->
# active session found
logger.debug "OK removed session '#{request.body.session}'"
resolve null
.catch ->
resolve null
.then ->
reply.send
success: true