new.vue 957 B

123456789101112131415161718192021222324252627282930313233343536
  1. <!-- Page de détails d'une adresse postale -->
  2. <template>
  3. <main>
  4. <v-skeleton-loader
  5. v-if="loading"
  6. type="text"
  7. />
  8. <FormOrganizationContactPoint :id="item.id" v-else></FormOrganizationContactPoint>
  9. </main>
  10. </template>
  11. <script lang="ts">
  12. import {defineComponent, useStore} from '@nuxtjs/composition-api'
  13. import {ContactPoint} from "~/models/Core/ContactPoint";
  14. import {UseDataUtils} from "~/use/data/useDataUtils";
  15. import {Store} from "vuex";
  16. export default defineComponent({
  17. name: 'NewContactPoint',
  18. setup (){
  19. const store:Store<any> = useStore()
  20. const {createItem} = new UseDataUtils().invoke()
  21. const {create, loading, item} = createItem()
  22. if(process.client){
  23. const itemToCreate: ContactPoint = new ContactPoint({organization:[`/api/organizations/${store.state.profile.organization.id}`]})
  24. create(itemToCreate, ContactPoint)
  25. }
  26. return {
  27. loading,
  28. item
  29. }
  30. }
  31. })
  32. </script>