new.vue 952 B

1234567891011121314151617181920212223242526272829303132333435
  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, useContext} from '@nuxtjs/composition-api'
  13. import {ContactPoint} from "~/models/Core/ContactPoint";
  14. import {useDataUtils} from "~/composables/data/useDataUtils";
  15. export default defineComponent({
  16. name: 'NewContactPoint',
  17. setup (){
  18. const {$dataProvider, store} = useContext()
  19. const {createItem} = useDataUtils($dataProvider)
  20. const {create, loading, item} = createItem(store, ContactPoint)
  21. if(process.client){
  22. const itemToCreate: ContactPoint = new ContactPoint({organization:[`/api/organizations/${store.state.profile.organization.id}`]})
  23. create(itemToCreate)
  24. }
  25. return {
  26. loading,
  27. item
  28. }
  29. }
  30. })
  31. </script>