Skouter mortgage estimates. Web application with view written in PHP and Vue, but controller and models in Go.
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 
 

40 satır
763 B

  1. <template>
  2. <section class="shadowbox">
  3. <h2>Register</h2>
  4. <account v-if="!step" :err="err" @submit="create" />
  5. </section>
  6. </template>
  7. <script setup>
  8. import { ref } from "vue"
  9. import Account from "./account.vue"
  10. let err = ref("")
  11. const step = ref(0)
  12. function create(user) {
  13. console.log(user)
  14. fetch(`/api/user`,
  15. {method: 'POST',
  16. body: JSON.stringify(user),
  17. headers: {
  18. "Accept": "application/json",
  19. },
  20. }).then(resp => {
  21. console.log(resp)
  22. if (resp.ok) {
  23. return resp.json()
  24. } else {
  25. resp.text().then( e => err.value = e)
  26. }
  27. }).then(u => console.log(u))
  28. }
  29. </script>
  30. <style scoped>
  31. section {
  32. max-width: 400px;
  33. margin: auto;
  34. }
  35. </style>