mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-30 14:39:29 +02:00
verify email workflow working
This commit is contained in:
parent
f007e8e87f
commit
a8f2ccb94b
23 changed files with 16363 additions and 15802 deletions
|
@ -3,6 +3,7 @@ import { lucia } from "@server/auth";
|
|||
import createHttpError from "http-errors";
|
||||
import HttpCode from "@server/types/HttpCode";
|
||||
import response from "@server/utils/response";
|
||||
import logger from "@server/logger";
|
||||
|
||||
export async function logout(
|
||||
req: Request,
|
||||
|
@ -20,14 +21,26 @@ export async function logout(
|
|||
);
|
||||
}
|
||||
|
||||
await lucia.invalidateSession(sessionId);
|
||||
res.setHeader("Set-Cookie", lucia.createBlankSessionCookie().serialize());
|
||||
try {
|
||||
await lucia.invalidateSession(sessionId);
|
||||
res.setHeader(
|
||||
"Set-Cookie",
|
||||
lucia.createBlankSessionCookie().serialize(),
|
||||
);
|
||||
|
||||
return response<null>(res, {
|
||||
data: null,
|
||||
success: true,
|
||||
error: false,
|
||||
message: "Logged out successfully",
|
||||
status: HttpCode.OK,
|
||||
});
|
||||
return response<null>(res, {
|
||||
data: null,
|
||||
success: true,
|
||||
error: false,
|
||||
message: "Logged out successfully",
|
||||
status: HttpCode.OK,
|
||||
});
|
||||
} catch (error) {
|
||||
return next(
|
||||
createHttpError(
|
||||
HttpCode.INTERNAL_SERVER_ERROR,
|
||||
"Failed to log out",
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue