File tree Expand file tree Collapse file tree
server/api/src/app/authentication/context
shared/src/lib/authentication/dto Expand file tree Collapse file tree Original file line number Diff line number Diff 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
5244export function removeAuthCookiesAndReply ( reply : FastifyReply ) : FastifyReply {
Original file line number Diff line number Diff 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} ;
You can’t perform that action at this time.
0 commit comments