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

405
Views
Cómo devolver un booleano de axios para deshabilitar un botón en vue

Leí casi todas las preguntas respondidas en el desbordamiento de pila para resolver esto, pero aún así no puedo resolverlo. Estoy tratando de llamar a una función para deshabilitar mi botón en vue y la función devuelve una promesa en lugar de un valor booleano. ¿Cómo puedo obtener un valor booleano aquí?

 <v-btn medium color="white" style="overflow: hidden" @click="runValidationTaskNow(index)" :loading="isRunTaskBtnDisabled(index)" :disabled="isRunTaskBtnDisabled(index)" >RUN NOW

......

En mis métodos, llamo a esta función que mencioné en desactivar y cargar.

 async isRunTaskBtnDisabled(index) { const Status = await Util.checkFeatureEnabled("Validate "+this.validationTasks[index].productName); // Status.then(value => value); return Status;

y el checkFeatureEnabled es de otro archivo que se proporciona a continuación

 async checkFeatureEnabled(featureName){ const reqURL = process.env.VUE_APP_GUIDE_UTILITY_SERVICES_HOST + `/api/checkFeatureEnabled/` + featureName; console.log("reqURL", reqURL); return await Axios(reqURL, { method: "GET", withCredentials: true }) .then((response) => { console.log("ui"+response.data); return response.data; }).catch((error) => console.log(error));

Aquí la response.data es verdadero o falso; Lo estoy obteniendo correctamente de mi base de datos.

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

0

cambiar esta parte

 return await Axios(reqURL, { method: "GET", withCredentials: true }) .then((response) => { console.log("ui"+response.data); return response.data; }).catch((error) => console.log(error));

a esto:

 try { const response = await Axios(reqURL, { method: 'GET', withCredentials: true }) console.log('ui' + response.data) return response.data } catch (e) { console.log(e) return something }
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!