Move api checks
This commit is contained in:
parent
d46b22e4a6
commit
a8019d86cc
|
@ -2,13 +2,6 @@
|
||||||
import { Updating } from "@budibase/frontend-core"
|
import { Updating } from "@budibase/frontend-core"
|
||||||
import { redirect, params } from "@roxi/routify"
|
import { redirect, params } from "@roxi/routify"
|
||||||
|
|
||||||
import { API } from "api"
|
|
||||||
|
|
||||||
async function isMigrationDone() {
|
|
||||||
const response = await API.getMigrationStatus()
|
|
||||||
return response.migrated
|
|
||||||
}
|
|
||||||
|
|
||||||
async function onMigrationDone() {
|
async function onMigrationDone() {
|
||||||
// For some reason routify params is not stripping the ? properly, so we need to check both with and without ?
|
// For some reason routify params is not stripping the ? properly, so we need to check both with and without ?
|
||||||
const returnUrl = $params.returnUrl || $params["?returnUrl"]
|
const returnUrl = $params.returnUrl || $params["?returnUrl"]
|
||||||
|
@ -16,4 +9,4 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Updating timeoutMs={180000} {isMigrationDone} {onMigrationDone} />
|
<Updating {onMigrationDone} />
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
export let isMigrationDone
|
import { API } from "api"
|
||||||
|
|
||||||
export let onMigrationDone
|
export let onMigrationDone
|
||||||
export let timeoutMs = 180000 // 3 minutes
|
export let timeoutMs = 180000 // 3 minutes
|
||||||
|
|
||||||
|
@ -8,8 +9,9 @@
|
||||||
|
|
||||||
async function checkMigrationsFinished() {
|
async function checkMigrationsFinished() {
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
const isMigrated = await isMigrationDone()
|
const response = await API.getMigrationStatus()
|
||||||
if (!isMigrated) {
|
|
||||||
|
if (!response.migrated) {
|
||||||
if (loadTime + timeoutMs > Date.now()) {
|
if (loadTime + timeoutMs > Date.now()) {
|
||||||
return checkMigrationsFinished()
|
return checkMigrationsFinished()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue