<!-- Page de détails d'une adresse postale -->
<template>
  <main>
    <v-skeleton-loader
      v-if="loading"
      type="text"
    />
    <FormOrganizationAddress :id="item.id" v-else></FormOrganizationAddress>
  </main>
</template>

<script lang="ts">
import {defineComponent} from '@nuxtjs/composition-api'
import { OrganizationAddressPostal } from '~/models/Organization/OrganizationAddressPostal'
import {AddressPostal} from "~/models/Core/AddressPostal";
import {UseDataUtils} from "~/use/data/useDataUtils";

export default defineComponent({
  name: 'NewOrganizationAddress',
  setup () {
    const {createItem} = new UseDataUtils().invoke()
    const {create, loading, item} = createItem()

    if(process.client){
      const itemToCreate: OrganizationAddressPostal = new OrganizationAddressPostal({addressPostal: new AddressPostal()})
      create(itemToCreate, OrganizationAddressPostal)
    }

    return {
      loading,
      item
    }
  }
})
</script>
