Change interval for timeout
This commit is contained in:
parent
342a1b487b
commit
3a2a2a242c
|
@ -2,19 +2,27 @@
|
||||||
import Spinner from "components/common/Spinner.svelte"
|
import Spinner from "components/common/Spinner.svelte"
|
||||||
import { API } from "api"
|
import { API } from "api"
|
||||||
|
|
||||||
setInterval(async () => {
|
let timeout
|
||||||
const response = await API.get({ url: "/api/migrations/status" })
|
async function checkMigrationsFinished() {
|
||||||
if (!response.migrated) {
|
timeout = setTimeout(async () => {
|
||||||
return
|
const response = await API.get({ url: "/api/migrations/status" })
|
||||||
}
|
if (!response.migrated) {
|
||||||
|
checkMigrationsFinished()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const urlParams = new URLSearchParams(window.location.search)
|
const urlParams = new URLSearchParams(window.location.search)
|
||||||
const returnUrl = urlParams.get("returnUrl")
|
const returnUrl = urlParams.get("returnUrl")
|
||||||
|
|
||||||
window.location = returnUrl
|
window.location = returnUrl
|
||||||
}, 1000)
|
}, 1000)
|
||||||
|
}
|
||||||
|
|
||||||
|
checkMigrationsFinished()
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
clearTimeout(timeout)
|
||||||
|
// TODO
|
||||||
alert("Something went wrong 💀")
|
alert("Something went wrong 💀")
|
||||||
}, 60000)
|
}, 60000)
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue