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

24 lines
553 B
CoffeeScript

logger = (require 'logging').default '/user/logout'
# session storage (volatile data)
session = (require '../../session')
module.exports =
url: '/user/logout'
method: 'POST'
schema: (require './logout.schema')
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