<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, fetchMe } = useAuth();

// Fetch the user state on initial client-side load.
// The middleware will wait for `initialized` to be true.
onMounted(() => {
  fetchMe();
});
</script>

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