<template>
  <div>
    <NuxtLayout>
      <div v-if="!initialized" class="loading-overlay">
        <p>Loading session...</p>
      </div>
      <NuxtPage v-else />
    </NuxtLayout>
  </div>
</template>

<script setup>
const { initialized, initAuth } = useAuth();

// Initialize the authentication state on client-side load.
// This will either fetch a logged-in user or create an anonymous session.
onMounted(() => {
  initAuth();
});
</script>

<style src="../assets/css/main.css"></style>
