go straight to app if you only have one published app
This commit is contained in:
parent
6e6bc536a1
commit
b412f10e6b
|
@ -13,7 +13,7 @@
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
import { onMount } from "svelte"
|
import { onMount } from "svelte"
|
||||||
import { apps, organisation, auth } from "stores/portal"
|
import { apps, organisation, auth } from "stores/portal"
|
||||||
import { goto } from "@roxi/routify"
|
import { goto, redirect } from "@roxi/routify"
|
||||||
import { AppStatus } from "constants"
|
import { AppStatus } from "constants"
|
||||||
import { gradient } from "actions"
|
import { gradient } from "actions"
|
||||||
import UpdateUserInfoModal from "components/settings/UpdateUserInfoModal.svelte"
|
import UpdateUserInfoModal from "components/settings/UpdateUserInfoModal.svelte"
|
||||||
|
@ -28,10 +28,17 @@
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
await organisation.init()
|
await organisation.init()
|
||||||
await apps.load()
|
await apps.load()
|
||||||
|
// Skip the portal if you only have one app
|
||||||
|
if (!$auth.isBuilder && $apps.filter(publishedAppsOnly).length === 1) {
|
||||||
|
window.location = `/${publishedApps[0].prodId}`
|
||||||
|
} else {
|
||||||
loaded = true
|
loaded = true
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
$: publishedApps = $apps.filter(app => app.status === AppStatus.DEPLOYED)
|
const publishedAppsOnly = app => app.status === AppStatus.DEPLOYED
|
||||||
|
|
||||||
|
$: publishedApps = $apps.filter(publishedAppsOnly)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if $auth.user && loaded}
|
{#if $auth.user && loaded}
|
||||||
|
|
|
@ -1,4 +1,18 @@
|
||||||
<script>
|
<script>
|
||||||
import { redirect } from "@roxi/routify"
|
import { onMount } from "svelte"
|
||||||
$redirect("./apps")
|
import { redirect, goto } from "@roxi/routify"
|
||||||
|
import { apps, organisation, auth } from "stores/portal"
|
||||||
|
import { AppStatus } from "constants"
|
||||||
|
|
||||||
|
onMount(async () => {
|
||||||
|
await apps.load()
|
||||||
|
// Skip the portal if you only have one app
|
||||||
|
if (!$auth.isBuilder && $apps.filter(app => app.status === AppStatus.DEPLOYED).length === 1) {
|
||||||
|
// window.location = `/${publishedApps[0].prodId}`
|
||||||
|
$redirect(`/${publishedApps[0].prodId}`)
|
||||||
|
} else {
|
||||||
|
$goto("./apps")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue