organization.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <template>
  2. <div class="d-flex flex-column align-center">
  3. <h2 class="ma-4">{{ $t('cmf_structure_licence')}}</h2>
  4. <a
  5. href="https://www.cmf-musique.org/services/tarifs-preferentiels/"
  6. target="_blank"
  7. >
  8. {{ $t('cmf_licence_details_url')}}
  9. </a>
  10. <v-form
  11. ref="form"
  12. lazy-validation
  13. >
  14. <v-btn class="ma-12" @click="submit">{{ $t('generate') }}</v-btn>
  15. </v-form>
  16. </div>
  17. </template>
  18. <script lang="ts">
  19. import {defineComponent, useContext} from "@nuxtjs/composition-api";
  20. import {HTTP_METHOD, QUERY_TYPE} from "~/types/enums";
  21. import DataPersister from "~/services/data/dataPersister";
  22. import {DataPersisterArgs} from "~/types/interfaces";
  23. export default defineComponent({
  24. name: 'OrganizationCmfLicence',
  25. setup() {
  26. const submit = async () => {
  27. const response = await DataPersister.request(
  28. '/api/export/cmf-licence/organization',
  29. HTTP_METHOD.POST,
  30. { type: QUERY_TYPE.DEFAULT, data: { format: 'pdf', async: true } } as DataPersisterArgs
  31. )
  32. console.debug(response)
  33. const eventSource = new EventSource("https://local.mercure.opentalent.fr/.well-known/mercure/ui/files/602066");
  34. eventSource.onmessage = event => {
  35. // Will be called every time an update is published by the server
  36. console.log(JSON.parse(event.data));
  37. }
  38. }
  39. return {
  40. submit
  41. }
  42. }
  43. })
  44. </script>