2018-03-29 01:57:00 -05:00
|
|
|
<template>
|
2019-11-10 10:40:26 -06:00
|
|
|
<div id="app">
|
2018-04-01 21:43:23 -05:00
|
|
|
<vue-progress-bar></vue-progress-bar>
|
2018-03-30 14:31:09 -05:00
|
|
|
<app-navbar></app-navbar>
|
2019-11-10 10:40:26 -06:00
|
|
|
<section id="main" class="">
|
2018-03-30 14:31:09 -05:00
|
|
|
<div class="container">
|
2024-09-28 20:58:25 -05:00
|
|
|
<router-view v-slot="{ Component }">
|
|
|
|
<transition name="fade" mode="out-in">
|
|
|
|
<component v-if="!hasError" :is="Component" />
|
|
|
|
<div v-else>
|
|
|
|
<h1>Error!</h1>
|
2024-09-29 13:35:49 -05:00
|
|
|
<p>{{ appConfig.error }}</p>
|
2024-09-28 20:58:25 -05:00
|
|
|
</div>
|
|
|
|
</transition>
|
|
|
|
</router-view>
|
2018-03-30 14:31:09 -05:00
|
|
|
</div>
|
|
|
|
</section>
|
2018-03-29 01:57:00 -05:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2024-09-29 13:35:49 -05:00
|
|
|
<script setup>
|
|
|
|
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from "vue";
|
2024-09-29 09:44:40 -05:00
|
|
|
import { useGlobalTweenGroup } from "../lib/useGlobalTweenGroup";
|
2024-09-28 20:58:25 -05:00
|
|
|
import { useAppConfigStore } from "../stores/appConfig";
|
2024-09-29 13:35:49 -05:00
|
|
|
import { useLoadResource } from "../lib/useLoadResource";
|
|
|
|
import { useCheckAuthentication } from "../lib/useCheckAuthentication";
|
2018-03-30 14:31:09 -05:00
|
|
|
|
2024-09-29 09:44:40 -05:00
|
|
|
const globalTweenGroup = useGlobalTweenGroup();
|
2024-09-29 13:35:49 -05:00
|
|
|
let animationLoop = true;
|
2024-09-29 09:44:40 -05:00
|
|
|
|
2024-09-29 13:35:49 -05:00
|
|
|
const appConfig = useAppConfigStore();
|
|
|
|
const hasError = computed(() => appConfig.error !== null);
|
2024-09-28 20:58:25 -05:00
|
|
|
|
2024-09-29 13:35:49 -05:00
|
|
|
const { loadResource } = useLoadResource();
|
|
|
|
const { checkAuthentication } = useCheckAuthentication(loadResource);
|
2018-03-29 01:57:00 -05:00
|
|
|
|
2024-09-29 13:35:49 -05:00
|
|
|
watch(
|
|
|
|
() => appConfig.initialLoad,
|
|
|
|
(val) => {
|
2018-04-01 21:43:23 -05:00
|
|
|
if (val) {
|
2024-09-29 13:35:49 -05:00
|
|
|
nextTick(() => document.body.classList.remove("loading"));
|
2018-04-01 21:43:23 -05:00
|
|
|
}
|
2019-11-10 10:40:26 -06:00
|
|
|
},
|
2024-09-29 13:35:49 -05:00
|
|
|
{ immediate: true }
|
|
|
|
);
|
2019-11-10 10:40:26 -06:00
|
|
|
|
2024-09-29 13:35:49 -05:00
|
|
|
watch(
|
|
|
|
() => appConfig.isLoading,
|
|
|
|
(val) => {
|
|
|
|
// Update Progress
|
2018-04-01 21:43:23 -05:00
|
|
|
}
|
2024-09-29 13:35:49 -05:00
|
|
|
)
|
2018-04-01 21:43:23 -05:00
|
|
|
|
2024-09-29 13:35:49 -05:00
|
|
|
onMounted(() => {
|
|
|
|
// Setup global animation loop
|
|
|
|
function animate() {
|
|
|
|
if (animationLoop) {
|
|
|
|
globalTweenGroup.update();
|
2018-09-13 14:51:41 -05:00
|
|
|
requestAnimationFrame(animate);
|
|
|
|
}
|
2024-09-29 13:35:49 -05:00
|
|
|
}
|
|
|
|
animate();
|
2019-11-10 10:40:26 -06:00
|
|
|
|
2024-09-29 13:35:49 -05:00
|
|
|
if (appConfig.user === null && appConfig.authChecked === false) {
|
|
|
|
checkAuthentication();
|
2018-03-30 14:31:09 -05:00
|
|
|
}
|
2024-09-29 13:35:49 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
onUnmounted(() => {
|
|
|
|
animationLoop = false;
|
|
|
|
});
|
2018-03-29 01:57:00 -05:00
|
|
|
|
|
|
|
</script>
|