<!--suppress JSValidateTypes -->
<template>
  <div>
    <SpinnerModal
      v-if="isPending"
      :visible="true"
    />

    <UserEditor
      v-else
      action="update"
      :userId="userId"
      :initialValue="user"
    />
  </div>
</template>

<script setup>
definePageMeta({
  name: "admin:userEdit",
  path: "/admin/users/:userId([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})",
  middleware: ["signed-in", "admin"]
})

const userId = useRoute().params?.userId
const { data: user, isPending } = useQuery(() => userByIdQuery(userId))
</script>

<style scoped></style>
