<template>
  <button v-h:64="48" v-w:1210="48" v-x:1210="70" v-y:64="8" @click="onClick()">
    <Spot />
  </button>
</template>

<script lang="ts" setup>
const router = useRouter()

function onClick() {
  const previousUrl = document.referrer
  const isSameSite = !previousUrl || new URL(previousUrl).hostname === window.location.hostname
  const canGoBack = window.history.length > 1

  if (isSameSite && canGoBack) {
    router.back()
  } else {
    navigateTo('/')
  }
}
</script>
