2020-11-08 13:54:08 -08:00
|
|
|
const verifyAuth = require('../../middlewares/verifyAuth')
|
|
|
|
const express = require('express')
|
2018-11-20 11:19:58 -08:00
|
|
|
|
|
|
|
module.exports = () => {
|
2020-11-08 13:54:08 -08:00
|
|
|
const router = express.Router()
|
2018-11-20 11:19:58 -08:00
|
|
|
|
2020-11-08 13:54:08 -08:00
|
|
|
router.get('/', verifyAuth(), (req, res) => res.render('logout'))
|
2018-11-20 11:19:58 -08:00
|
|
|
router.post('/', (req, res) => {
|
2020-11-08 13:54:08 -08:00
|
|
|
req.logout()
|
|
|
|
res.redirect('/')
|
|
|
|
})
|
2018-11-20 11:19:58 -08:00
|
|
|
|
2020-11-08 13:54:08 -08:00
|
|
|
return router
|
|
|
|
}
|