The frontend component of PuffPastry, meant to interface with the backend, which in turn interfaces with the smart contract.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 

48 lignes
1.3 KiB

  1. <template>
  2. <Modal header="New Issue" @submitted="submit">
  3. <slot>
  4. <div class="my-3">
  5. <input type="text" class="w-full border-gray-300 border border-solid py-2 px-2.5" placeholder="Title" aria-label="Title" v-model="title" />
  6. </div>
  7. <div class="my-3">
  8. <PostBuilder @text-change="assignDescription" />
  9. </div>
  10. </slot>
  11. </Modal>
  12. </template>
  13. <script setup lang="ts" generic="T extends ContentModal">
  14. import { useFetch } from "../../composables/useFetch.ts";
  15. import { useSession } from "../../composables/useSession.ts";
  16. import Modal from "./Modal.vue";
  17. import { ref } from "vue";
  18. import { AddIssueRequest, AddIssueResponse } from "../../types/issue.ts";
  19. import PostBuilder from "../PostBuilder.vue";
  20. import { ContentModal } from "../../composables/useModal.ts";
  21. const title = ref('');
  22. const description = ref<string[]>(['']);
  23. const { post } = useFetch();
  24. const submit = async () => {
  25. const { getSessionId } = useSession();
  26. const sessionId = getSessionId();
  27. if (sessionId) {
  28. await post<AddIssueRequest, AddIssueResponse>('/issues/create', {
  29. title: title.value,
  30. paragraphs: description.value
  31. });
  32. }
  33. }
  34. const assignDescription = (paragraphs: string[]) => {
  35. description.value = paragraphs;
  36. }
  37. </script>
  38. <style scoped>
  39. </style>