<template>
  <div>
    <SpinnerModal
      v-if="isLoading"
      :visible="true"
    />

    <CharacterEditor
      v-else
      action="view"
      :characterId="characterId"
      :initialValue="character"
    />
  </div>
</template>

<script setup>
definePageMeta({
  name: "characterView",
  path: "/show/:characterId(\\d+)"
})

const characterId = _toInteger(useRoute().params?.characterId)
const { data: character, isLoading } = useQuery(() => characterByIdQuery(characterId))
</script>

<style scoped></style>
