fix(striker-ui-api): add session cookie to hold expiry

This commit is contained in:
Tsu-ba-me 2023-11-27 13:51:26 -05:00
parent b5927cf0a3
commit 34bd441c83
2 changed files with 6 additions and 2 deletions

View File

@ -7,13 +7,16 @@ export const login: RequestHandler<unknown, unknown, AuthLoginRequestBody> = (
request, request,
response, response,
) => { ) => {
const { user } = request; const { session, user } = request;
if (user) { if (user) {
const { name: userName } = user; const { name: userName } = user;
stdout(`Successfully authenticated user [${userName}]`); stdout(`Successfully authenticated user [${userName}]`);
response.cookie(cname('session'), {
expires: session?.cookie?.expires,
});
response.cookie(cname('user'), user); response.cookie(cname('user'), user);
} }

View File

@ -11,8 +11,9 @@ export const logout: RequestHandler = (request, response) => {
return response.status(500).send(); return response.status(500).send();
} }
response.clearCookie(cname('user')); response.clearCookie(cname('session'));
response.clearCookie(cname('sid')); response.clearCookie(cname('sid'));
response.clearCookie(cname('user'));
return response.status(204).send(); return response.status(204).send();
}); });