This commit is contained in:
mike12345567 2020-11-06 21:32:03 +00:00
parent ce12325b8c
commit 5f0912e6ff
1 changed files with 4 additions and 2 deletions

View File

@ -2,8 +2,10 @@ const COOKIE_SEPARATOR = ";"
const APP_PREFIX = "app_"
const KEY_VALUE_SPLIT = "="
export const getAppId = (allCookies) => {
const cookie = allCookies.split(COOKIE_SEPARATOR).find(cookie => cookie.trim().startsWith("budibase:currentapp"))
export const getAppId = allCookies => {
const cookie = allCookies
.split(COOKIE_SEPARATOR)
.find(cookie => cookie.trim().startsWith("budibase:currentapp"))
let appId = location.pathname.split("/")[1]
appId = appId && appId.startsWith(APP_PREFIX) ? appId : undefined
if (!appId && cookie && cookie.split(KEY_VALUE_SPLIT).length === 2) {