52 lines
1.5 KiB
Vue
52 lines
1.5 KiB
Vue
<script setup>
|
|
import {useRoute, useRouter} from "vue-router";
|
|
import {computed, onBeforeMount, onUnmounted, ref} from "vue";
|
|
import {useAuthStore} from "stores/Auth";
|
|
|
|
const $route = useRoute();
|
|
const $router = useRouter();
|
|
|
|
const url = computed(() => $route.query.url || '/moje');
|
|
const showLoginInfo = ref(false);
|
|
const defaultRedirectTimeout = ref(null);
|
|
|
|
onBeforeMount(() => {
|
|
useAuthStore().refreshAccessToken()
|
|
.then(() => $router.push(url.value))
|
|
.catch(e => $router.push({name: "login"}));
|
|
|
|
setTimeout(() => showLoginInfo.value = true, 1000);
|
|
defaultRedirectTimeout.value = setTimeout(() => $router.push(url.value), 10000);
|
|
});
|
|
|
|
onUnmounted(() => {
|
|
clearTimeout(defaultRedirectTimeout.value);
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<div class="row justify-center">
|
|
<div class="col-sm-12 col-4">
|
|
<transition
|
|
v-if="showLoginInfo"
|
|
appear
|
|
enter-active-class="animated fadeIn"
|
|
leave-active-class="animated fadeOut"
|
|
>
|
|
<q-card style="max-width: 100%" class="q-my-lg">
|
|
<q-card-section class="text-center">
|
|
<q-spinner size="80px" color="primary"/>
|
|
<br>
|
|
<p class="q-my-lg">
|
|
Probíhá přihlašování. Za okamžik dojde k přesměrování. Pokud se tak nestane, klikni na tlačítko
|
|
</p>
|
|
</q-card-section>
|
|
<q-card-actions>
|
|
<q-btn class="full-width" color="primary" size="lg" :to="url">Návrat do rozhraní</q-btn>
|
|
</q-card-actions>
|
|
</q-card>
|
|
</transition>
|
|
</div>
|
|
</div>
|
|
</template>
|