<script setup lang="ts">
import { defineAsyncComponent, onMounted } from "vue";
import { useDesktopSession } from "./composables/useDesktopSession";

const DesktopShell = defineAsyncComponent(() => import("./components/DesktopShell.vue"));
const LoginView = defineAsyncComponent(() => import("./views/LoginView.vue"));

const { isAuthenticated, syncRuntimeSession } = useDesktopSession();

onMounted(() => {
  void syncRuntimeSession();
});
</script>

<template>
  <DesktopShell v-if="isAuthenticated" />
  <LoginView v-else />
</template>
