Pass isMigrationDone
This commit is contained in:
parent
3dcb3dec3f
commit
03a933005d
|
@ -2,6 +2,13 @@
|
|||
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"]
|
||||
|
@ -9,4 +16,4 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
<Updating {onMigrationDone} />
|
||||
<Updating {isMigrationDone} {onMigrationDone} />
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
<script>
|
||||
import * as API from "../api"
|
||||
|
||||
export let isMigrationDone
|
||||
export let onMigrationDone
|
||||
export let timeoutSeconds = 3 * 60 // 3 minutes
|
||||
export let timeoutSeconds = 10 // 3 minutes
|
||||
|
||||
const loadTime = Date.now()
|
||||
let timedOut = false
|
||||
|
||||
async function checkMigrationsFinished() {
|
||||
setTimeout(async () => {
|
||||
const response = await API.getMigrationStatus()
|
||||
const isMigrated = await isMigrationDone()
|
||||
|
||||
const timeoutMs = timeoutSeconds * 1000
|
||||
if (!response.migrated) {
|
||||
if (!isMigrated) {
|
||||
if (loadTime + timeoutMs > Date.now()) {
|
||||
return checkMigrationsFinished()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue