<template>
  <div class="bg-neutral-800 border-b border-b-gray-700 flex items-center px-5">
    <h1 class="text-primary text-2xl font-bold">Polarcraft</h1>
    <Button outline class="ml-auto" @click="logout">Logout</Button>
  </div>
</template>

<script setup>
const logout = async () => {
  try {
    await useFetch('/api/auth/logout')

    navigateTo('/login')
  } catch (err) {
    console.log(err)
    alert(err.statusMessage)
  }
}
</script>
