1
0

fix: wait until everything is loaded before replacing the current view with the last or login view

This commit is contained in:
kolaente
2022-10-23 16:12:38 +02:00
parent 3f04571e43
commit 6083301d1f
5 changed files with 36 additions and 19 deletions

View File

@ -61,7 +61,7 @@ const route = useRoute()
const baseStore = useBaseStore()
const ready = ref(false)
const ready = computed(() => baseStore.ready)
const online = useOnline()
const error = ref('')
@ -70,11 +70,11 @@ const showLoading = computed(() => !ready.value && error.value === '')
async function load() {
try {
await baseStore.loadApp()
const redirectTo = getAuthForRoute(route)
baseStore.setReady(true)
const redirectTo = await getAuthForRoute(route)
if (typeof redirectTo !== 'undefined') {
await router.push(redirectTo)
}
ready.value = true
} catch (e: unknown) {
error.value = String(e)
}