fix cookie name

This commit is contained in:
Philipinho
2025-03-06 21:44:53 +00:00
parent 93ea31feb0
commit 315afd6818

View File

@ -46,19 +46,20 @@ export class JwtAuthGuard extends AuthGuard('jwt') {
const res = ctx.switchToHttp().getResponse(); const res = ctx.switchToHttp().getResponse();
const workspaceId = user?.workspace?.id; const workspaceId = user?.workspace?.id;
let hosts = []; let workspaceIds = [];
try { try {
hosts = req.cookies.workspaces ? JSON.parse(req.cookies.hosts) : []; workspaceIds = req.cookies.joinedWorkspaces
? JSON.parse(req.cookies.joinedWorkspaces)
: [];
} catch (err) { } catch (err) {
/* empty */ /* empty */
} }
if (!hosts.includes(workspaceId)) { if (!workspaceIds.includes(workspaceId)) {
hosts.push(workspaceId); workspaceIds.push(workspaceId);
} }
// todo: revisit res.setCookie('joinedWorkspaces', JSON.stringify(workspaceIds), {
res.setCookie('joinedWorkspaces', JSON.stringify(hosts), {
httpOnly: false, httpOnly: false,
domain: '.' + this.environmentService.getSubdomainHost(), domain: '.' + this.environmentService.getSubdomainHost(),
path: '/', path: '/',