add sessionDestroy func
This commit is contained in:
parent
5392b032d0
commit
96a73035f8
|
@ -82,7 +82,7 @@ httpServer.get("/site", (_req, rep) => {
|
||||||
httpServer.delete("/session", (req, _rep) => {
|
httpServer.delete("/session", (req, _rep) => {
|
||||||
const username = req.session.user as string ?? "";
|
const username = req.session.user as string ?? "";
|
||||||
if (username.length > 0) {
|
if (username.length > 0) {
|
||||||
delete req.session.user;
|
req.sessionDestroy();
|
||||||
return {
|
return {
|
||||||
code: 200,
|
code: 200,
|
||||||
message: "Logged out!",
|
message: "Logged out!",
|
||||||
|
|
4
mod.ts
4
mod.ts
|
@ -448,6 +448,10 @@ export class RouteRequest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sessionDestroy(): void {
|
||||||
|
this.session = {};
|
||||||
|
}
|
||||||
|
|
||||||
header(name: string): unknown {
|
header(name: string): unknown {
|
||||||
const matchingHeader = Array.from(this.headers.keys()).find((headerName) =>
|
const matchingHeader = Array.from(this.headers.keys()).find((headerName) =>
|
||||||
headerName === name
|
headerName === name
|
||||||
|
|
Reference in New Issue
Block a user