Skip to content

Commit 8fda1aa

Browse files
committed
Make tablesWorkspaceId mandatory
1 parent f051654 commit 8fda1aa

2 files changed

Lines changed: 12 additions & 20 deletions

File tree

packages/server/api/src/app/authentication/context/authentication-cookies.ts

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function setAuthCookiesAndReply(
1515
const date = jwtDecode<{ exp: number }>(response.tablesRefreshToken);
1616
const cookieExpiryDate = new Date(date.exp * 1000);
1717

18-
let replyWithCookies = reply
18+
return reply
1919
.setCookie('jwt_token', response.tablesRefreshToken, {
2020
domain: getOpenOpsSubDomain(),
2121
path: '/',
@@ -29,24 +29,16 @@ export function setAuthCookiesAndReply(
2929
httpOnly: false,
3030
expires: cookieExpiryDate,
3131
sameSite: 'lax',
32-
});
33-
34-
if (response.tablesWorkspaceId !== undefined) {
35-
replyWithCookies = replyWithCookies.setCookie(
36-
'baserow_group_id',
37-
String(response.tablesWorkspaceId),
38-
{
39-
domain: getOpenOpsSubDomain(),
40-
path: '/',
41-
signed: true,
42-
httpOnly: false,
43-
expires: cookieExpiryDate,
44-
sameSite: 'lax',
45-
},
46-
);
47-
}
48-
49-
return replyWithCookies.send(response);
32+
})
33+
.setCookie('baserow_group_id', String(response.tablesWorkspaceId), {
34+
domain: getOpenOpsSubDomain(),
35+
path: '/',
36+
signed: true,
37+
httpOnly: false,
38+
expires: cookieExpiryDate,
39+
sameSite: 'lax',
40+
})
41+
.send(response);
5042
}
5143

5244
export function removeAuthCookiesAndReply(reply: FastifyReply): FastifyReply {

packages/shared/src/lib/authentication/dto/authentication-response.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ export type AuthenticationResponse = UserWithoutPassword & {
88
projectId: string;
99
projectRole: ProjectMemberRole | null;
1010
tablesRefreshToken: string;
11-
tablesWorkspaceId?: number;
11+
tablesWorkspaceId: number;
1212
};

0 commit comments

Comments
 (0)