Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

158
Vistas
trigger a method from inside another function

I have a method that sends data to the database and can be triggered from a button using @click but I want to trigger it from another function by calling it in conditional function any one can help? the post is edited so I want to add the addPatient method called right after submitted notification is triggered in else{}

  onSubmit () {


    namefRef.value.validate()
    namelRef.value.validate()
    birthdateRef.value.validate()

    if (namefRef.value.hasError || namelRef.value.hasError || birthdateRef.value.hasError ) {
      // form has error
    }
    else if (gender.value !== 'male'&& gender.value !== 'female') {
      $q.notify({
        color: 'negative',
        message: 'You need to choose a gender'
      })

    }
    else {

      $q.notify({

        icon: 'done',
        color: 'positive',
        message: 'Submitted',

      }),

      loadinga.value = true



      setTimeout(() => {loadinga.value = false }, 300)
    }

  },


}

},

data() {
    return{
       patient:{
          id:uid(),
          caption:'',
          namef:'',
          namel:'',
          age:'',
          lastappointment:'',
          location:'',
          photo:null,
          date:Date.now()
       },
   loading:false,

}

},

methods:{
   addPatient() {

  let formData = new FormData()
  formData.append('id', this.patient.id)
  formData.append('index', this.patient.index)
  formData.append('namef', this.namef)
  formData.append('namel', this.namel)
  formData.append('age', this.patient.age)
  formData.append('date', this.patient.date)
  formData.append('lastappointment', this.patient.lastappointment)
 //* formData.append('file', this.patient.photo, this.patient.id + '.png')
  this.$axios.post(`${ process.env.API}/createPatient`, formData).then(
    response => {
      console.log('response:',response)

    }).catch(err => {
    console.log('err:',err)
  })
}
about 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda