fix redirect issues when refreshing page

This commit is contained in:
kevmodrome 2020-04-09 10:55:47 +02:00
parent 4e48fc60a5
commit 5a3de93734
3 changed files with 23 additions and 8 deletions

View File

@ -24,13 +24,6 @@
return state
})
}
onMount(() => {
if ($store.appInstances.length > 0) {
selectDatabase($store.appInstances[0])
$goto(`./database/${$backendUiStore.selectedDatabase.id}`)
}
})
</script>
<div class="root">

View File

@ -44,7 +44,7 @@
</div>
{#if $backendUiStore.selectedDatabase.id}
<ModelDataTable {selectRecord} />
{:else}Please select a database{/if}
{/if}
<style>
.database-actions {

View File

@ -1 +1,23 @@
<script>
import { store, backendUiStore } from "builderStore"
import { goto } from "@sveltech/routify"
import { onMount } from "svelte"
$: instances = $store.appInstances
$: views = $store.hierarchy.indexes
async function selectDatabase(database) {
backendUiStore.actions.records.select(null)
backendUiStore.actions.views.select(views[0])
backendUiStore.actions.database.select(database)
}
onMount(async () => {
if ($store.appInstances.length > 0) {
await selectDatabase($store.appInstances[0])
$goto(`../${$backendUiStore.selectedDatabase.id}`)
}
})
</script>
Please select a database