From c2fa27038673f26aa75796d1570b8ab2f62c20a4 Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Thu, 15 Sep 2022 11:59:46 +0100 Subject: [PATCH] Fixes --- packages/backend-core/src/constants.js | 2 +- packages/builder/src/pages/builder/_layout.svelte | 5 +++-- packages/builder/src/pages/builder/portal/_layout.svelte | 3 +-- packages/builder/src/stores/portal/licensing.js | 4 ++++ packages/frontend-core/src/constants.js | 1 + 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/backend-core/src/constants.js b/packages/backend-core/src/constants.js index 89d4fd33e6..44c271a4f8 100644 --- a/packages/backend-core/src/constants.js +++ b/packages/backend-core/src/constants.js @@ -7,7 +7,7 @@ exports.Cookies = { CurrentApp: "budibase:currentapp", Auth: "budibase:auth", Init: "budibase:init", - RETURN_URL: "budibase:returnurl", + ACCOUNT_RETURN_URL: "budibase:account:returnurl", DatasourceAuth: "budibase:datasourceauth", OIDC_CONFIG: "budibase:oidc:config", } diff --git a/packages/builder/src/pages/builder/_layout.svelte b/packages/builder/src/pages/builder/_layout.svelte index ee8b1bb8df..8d604e8790 100644 --- a/packages/builder/src/pages/builder/_layout.svelte +++ b/packages/builder/src/pages/builder/_layout.svelte @@ -63,8 +63,9 @@ await auth.getSelf() await admin.init() - await licensing.getQuotaUsage() - await licensing.getUsageMetrics() + if ($auth.user) { + await licensing.init() + } // Set init info if present if ($params["?template"]) { diff --git a/packages/builder/src/pages/builder/portal/_layout.svelte b/packages/builder/src/pages/builder/portal/_layout.svelte index ff653c4cb7..bdf18ab508 100644 --- a/packages/builder/src/pages/builder/portal/_layout.svelte +++ b/packages/builder/src/pages/builder/portal/_layout.svelte @@ -13,8 +13,7 @@ notifications, } from "@budibase/bbui" import ConfigChecklist from "components/common/ConfigChecklist.svelte" - import { organisation, auth } from "stores/portal" - import { admin as adminStore } from "stores/portal" + import { organisation, auth, admin as adminStore } from "stores/portal" import { onMount } from "svelte" import UpdateUserInfoModal from "components/settings/UpdateUserInfoModal.svelte" import ChangePasswordModal from "components/settings/ChangePasswordModal.svelte" diff --git a/packages/builder/src/stores/portal/licensing.js b/packages/builder/src/stores/portal/licensing.js index ecf0ccb8c2..9d63a9edb5 100644 --- a/packages/builder/src/stores/portal/licensing.js +++ b/packages/builder/src/stores/portal/licensing.js @@ -13,6 +13,10 @@ export const createLicensingStore = () => { const store = writable(DEFAULT) const actions = { + init: async () => { + await actions.getQuotaUsage() + await actions.getUsageMetrics() + }, getQuotaUsage: async () => { const quotaUsage = await API.getQuotaUsage() store.update(state => { diff --git a/packages/frontend-core/src/constants.js b/packages/frontend-core/src/constants.js index a5b3650b1c..633534dddb 100644 --- a/packages/frontend-core/src/constants.js +++ b/packages/frontend-core/src/constants.js @@ -57,6 +57,7 @@ export const Cookies = { Auth: "budibase:auth", CurrentApp: "budibase:currentapp", ReturnUrl: "budibase:returnurl", + AccountReturnUrl: "budibase:account:returnurl", } // Table names