<!-- Page de création d'un nouveau sous-domaine -->
<template>
  <main>
    <v-skeleton-loader
      v-if="loading"
      type="text"
    />
    <div v-else>
      <FormParametersSubdomainNew :id="item.id"></FormParametersSubdomainNew>
    </div>
  </main>
</template>

<script lang="ts">
import {defineComponent, useContext} from '@nuxtjs/composition-api'
import {useDataUtils} from "~/composables/data/useDataUtils";
import {ResidenceArea} from "~/models/Billing/ResidenceArea";
import {Subdomain} from "~/models/Organization/Subdomain";
import {repositoryHelper} from "~/services/store/repository";

export default defineComponent({
  name: 'NewFormParametersSubdomain',
  setup () {
    const {$dataProvider, store} = useContext()
    const {createItem} = useDataUtils($dataProvider)
    const {create, loading, item} = createItem(store, Subdomain)

    if(process.client){
      const itemToCreate: Subdomain = new Subdomain()
      create(itemToCreate)
    }

    return {
      loading,
      item
    }
  },
  beforeDestroy() {
    repositoryHelper.cleanRepository(Subdomain)
  }
})
</script>
