"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.withLogout = void 0; const getLogoutPath = (admin) => { const { logoutPath } = admin.options; return logoutPath.startsWith('/') ? logoutPath : `/${logoutPath}`; }; const withLogout = (fastifyApp, admin) => { const logoutPath = getLogoutPath(admin); fastifyApp.get(logoutPath, async (request, reply) => { if (request.session) { request.session.destroy(() => { reply.redirect(admin.options.loginPath); }); } else { reply.redirect(admin.options.loginPath); } }); }; exports.withLogout = withLogout;