1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-04-21 20:12:53 +00:00
bramw_baserow/web-frontend/modules/core/utils/group.js

24 lines
669 B
JavaScript

import { isSecureURL } from '@baserow/modules/core/utils/string'
const cookieGroupName = 'baserow_group_id'
export const setGroupCookie = (groupId, { $cookies, $env }) => {
if (process.SERVER_BUILD) return
const secure = isSecureURL($env.PUBLIC_WEB_FRONTEND_URL)
$cookies.set(cookieGroupName, groupId, {
path: '/',
maxAge: 60 * 60 * 24 * 7,
sameSite: secure ? 'strict' : 'lax',
secure,
})
}
export const unsetGroupCookie = ({ $cookies }) => {
if (process.SERVER_BUILD) return
$cookies.remove(cookieGroupName)
}
export const getGroupCookie = ({ $cookies }) => {
if (process.SERVER_BUILD) return
return $cookies.get(cookieGroupName)
}