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

25 lines
553 B
CoffeeScript
Raw Normal View History

2019-05-09 12:32:28 +00:00
logger = (require 'logging').default '/user/logout'
2019-05-07 20:15:18 +00:00
# session storage (volatile data)
session = (require '../../session')
module.exports =
url: '/user/logout'
method: 'POST'
2019-05-09 12:32:42 +00:00
schema: (require './logout.schema')
2019-05-07 20:15:18 +00:00
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