diff --git a/packages/builder/src/components/deploy/RevertModal.svelte b/packages/builder/src/components/deploy/RevertModal.svelte index 7f4decebee..bc2ad0d0aa 100644 --- a/packages/builder/src/components/deploy/RevertModal.svelte +++ b/packages/builder/src/components/deploy/RevertModal.svelte @@ -1,9 +1,16 @@ diff --git a/packages/builder/src/components/start/CreateAppModal.svelte b/packages/builder/src/components/start/CreateAppModal.svelte index 1db5e46261..68845e075b 100644 --- a/packages/builder/src/components/start/CreateAppModal.svelte +++ b/packages/builder/src/components/start/CreateAppModal.svelte @@ -157,6 +157,11 @@ } return title } + + async function onCancel() { + template = null + await auth.setInitInfo({}) + } {#if showTemplateSelection} @@ -186,7 +191,7 @@ title={getModalTitle()} confirmText={template?.fromFile ? "Import app" : "Create app"} onConfirm={createNewApp} - onCancel={inline ? () => (template = null) : null} + onCancel={inline ? onCancel : null} cancelText={inline ? "Back" : undefined} showCloseIcon={!inline} disabled={!valid} diff --git a/packages/builder/src/stores/portal/auth.js b/packages/builder/src/stores/portal/auth.js index bd08611fc9..9a12667a7e 100644 --- a/packages/builder/src/stores/portal/auth.js +++ b/packages/builder/src/stores/portal/auth.js @@ -80,6 +80,10 @@ export function createAuthStore() { } } + async function setInitInfo(info) { + await api.post(`/api/global/auth/init`, info) + } + return { subscribe: store.subscribe, setOrganisation: setOrganisation, @@ -87,9 +91,7 @@ export function createAuthStore() { const response = await api.get(`/api/global/auth/init`) return await response.json() }, - setInitInfo: async info => { - await api.post(`/api/global/auth/init`, info) - }, + setInitInfo, checkQueryString: async () => { const urlParams = new URLSearchParams(window.location.search) if (urlParams.has("tenantId")) { @@ -129,6 +131,7 @@ export function createAuthStore() { throw "Unable to create logout" } await response.json() + await setInitInfo({}) setUser(null) }, updateSelf: async fields => { diff --git a/packages/server/src/api/controllers/application.js b/packages/server/src/api/controllers/application.js index f27efff29e..4ea308a790 100644 --- a/packages/server/src/api/controllers/application.js +++ b/packages/server/src/api/controllers/application.js @@ -323,7 +323,7 @@ exports.delete = async ctx => { ctx.body = result } -exports.sync = async ctx => { +exports.sync = async (ctx, next) => { const appId = ctx.params.appId if (!isDevAppID(appId)) { ctx.throw(400, "This action cannot be performed for production apps") @@ -336,10 +336,11 @@ exports.sync = async ctx => { if (info.error) throw info.error } catch (err) { // the database doesn't exist. Don't replicate + ctx.status = 200 ctx.body = { message: "App sync not required, app not deployed.", } - return + return next() } const replication = new Replication({