Implement refresh
This commit is contained in:
parent
75b8190c01
commit
94f0d38fe4
|
@ -1,4 +1,30 @@
|
|||
<script>
|
||||
import { API } from "../api"
|
||||
|
||||
const timeoutMs = 60000 // 1 minute
|
||||
const loadTime = Date.now()
|
||||
|
||||
async function checkMigrationsFinished() {
|
||||
setTimeout(async () => {
|
||||
const response = await API.getMigrationStatus()
|
||||
if (!response.migrated) {
|
||||
if (loadTime + timeoutMs > Date.now()) {
|
||||
return checkMigrationsFinished()
|
||||
}
|
||||
|
||||
return migrationTimeout()
|
||||
}
|
||||
|
||||
window.location.reload()
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
checkMigrationsFinished()
|
||||
|
||||
function migrationTimeout() {
|
||||
// TODO
|
||||
alert("Something went wrong 💀")
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="loading">Updating the system...</div>
|
||||
|
|
Loading…
Reference in New Issue