Add registration page, fix auth paths, and improve navigation
This commit is contained in:
37
.output/server/chunks/routes/api/auth/logout.post.mjs
Normal file
37
.output/server/chunks/routes/api/auth/logout.post.mjs
Normal file
@@ -0,0 +1,37 @@
|
||||
import { d as defineEventHandler, g as getCookie, a as deleteCookie, c as createError } from '../../../nitro/nitro.mjs';
|
||||
import { d as deleteSession } from '../../../_/auth.mjs';
|
||||
import 'node:http';
|
||||
import 'node:https';
|
||||
import 'node:events';
|
||||
import 'node:buffer';
|
||||
import 'node:fs';
|
||||
import 'node:path';
|
||||
import 'node:crypto';
|
||||
import 'node:url';
|
||||
import 'bcryptjs';
|
||||
import 'jsonwebtoken';
|
||||
import 'fs';
|
||||
import 'path';
|
||||
|
||||
const logout_post = defineEventHandler(async (event) => {
|
||||
try {
|
||||
const token = getCookie(event, "auth_token");
|
||||
if (token) {
|
||||
await deleteSession(token);
|
||||
}
|
||||
deleteCookie(event, "auth_token");
|
||||
return {
|
||||
success: true,
|
||||
message: "Erfolgreich abgemeldet"
|
||||
};
|
||||
} catch (error) {
|
||||
console.error("Logout-Fehler:", error);
|
||||
throw createError({
|
||||
statusCode: 500,
|
||||
message: "Abmeldung fehlgeschlagen"
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
export { logout_post as default };
|
||||
//# sourceMappingURL=logout.post.mjs.map
|
||||
Reference in New Issue
Block a user