Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

276
Views
Error de promesa de Vue, tengo un error con la promesa

Si bien el mismo método funciona bien con otra llamada a la API, obtener de esta API me está dando un error en la promesa. el error dice Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'json')

Mi código de búsqueda dice lo siguiente:

 import { ref } from "vue"; export default { async setup() { const prompProducts = ref(null); const bc_prompProducts = await fetch( "https://booking.hemantbhutanrealestate.com/api/v1/get_frontend_products" ); prompProducts.value = await bc_prompProducts.json(); return { prompProducts, }; }, };

Si bien este mismo método funciona sin errores en mis otras llamadas a la API, recibo un error en esta. ¡Por favor ayuda, el sitio ya está en producción!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede poner su llamada asíncrona en función y llamarla, o puede usar el gancho onMounted :

 const { ref, onMounted } = Vue const app = Vue.createApp({ setup() { const prompProducts = ref([]); onMounted(async() => { const bc_prompProducts = await fetch( "https://booking.hemantbhutanrealestate.com/api/v1/get_frontend_products" ) prompProducts.value = await bc_prompProducts.json() }) return { prompProducts } }, }) app.mount('#demo')
 <script src="https://unpkg.com/vue@3/dist/vue.global.prod.js"></script> <div id="demo"> <div v-for="pro in prompProducts" :key="pro.id"> <p>{{ pro }}</p> </div> </div>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!