Move api checks
This commit is contained in:
parent
d46b22e4a6
commit
a8019d86cc
|
@ -2,13 +2,6 @@
|
|||
import { Updating } from "@budibase/frontend-core"
|
||||
import { redirect, params } from "@roxi/routify"
|
||||
|
||||
import { API } from "api"
|
||||
|
||||
async function isMigrationDone() {
|
||||
const response = await API.getMigrationStatus()
|
||||
return response.migrated
|
||||
}
|
||||
|
||||
async function onMigrationDone() {
|
||||
// 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"]
|
||||
|
@ -16,4 +9,4 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
<Updating timeoutMs={180000} {isMigrationDone} {onMigrationDone} />
|
||||
<Updating {onMigrationDone} />
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<script>
|
||||
export let isMigrationDone
|
||||
import { API } from "api"
|
||||
|
||||
export let onMigrationDone
|
||||
export let timeoutMs = 180000 // 3 minutes
|
||||
|
||||
|
@ -8,8 +9,9 @@
|
|||
|
||||
async function checkMigrationsFinished() {
|
||||
setTimeout(async () => {
|
||||
const isMigrated = await isMigrationDone()
|
||||
if (!isMigrated) {
|
||||
const response = await API.getMigrationStatus()
|
||||
|
||||
if (!response.migrated) {
|
||||
if (loadTime + timeoutMs > Date.now()) {
|
||||
return checkMigrationsFinished()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue