<script setup>
import { onMounted } from 'vue'

const { isAuthenticated, initializeAuth } = useAuth()

onMounted(async () => {
  const isReady = await initializeAuth({ redirectTo: '/oauth', replace: true })
  if (isReady && isAuthenticated.value) {
    await navigateTo('/', { replace: true })
  }
})
</script>

<template>
  <div style="display: flex; justify-content: center; align-items: center; min-height: 100vh; background: #0d1117;">
    <span class="spinner sm"></span>
  </div>
</template>