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

102
Views
Los datos devueltos de la función son datos de promesa (cumplidos)
defaultValue = getFile(getCurrent.value[name])

Función getFile:

 const getFile = async (id) => { const data = store.dispatch(Actions.FILE, id).then(() => { const data = [{ description: store.getters.currentFile.description, url: 'https://test.com/uploads/'+ store.getters.currentFile.name }] return data }) return data }

Si hago console.log(defaultValue): veo el siguiente resultado; ingrese la descripción de la imagen aquí

Pero necesito una matriz en lugar de esta promesa. ¿Cómo resolver?

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

0

Debe usar la palabra clave await en su getFile para recuperar el valor de la promesa frontal porque su getFile devuelve Promise.

 async function yourFunc() { defaultValue = await getFile(getCurrent.value[name]) // do whatever you want }
about 4 years ago · Juan Pablo Isaza Report

0

Necesitas usar la palabra clave await

 const getFile = async (id) => { await store.dispatch(Actions.FILE, id); return [{ description: store.getters.currentFile.description, url: 'https://test.com/uploads/'+ store.getters.currentFile.name }] }

y luego espere la llamada para getFile también

 defaultValue = await getFile(getCurrent.value[name])
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!