Ionic 4: create reusable alert controller component with data submit

Hello everyone, i need a little help to build a alert controller reusable component where i want to use handler to submit data, i have 2 functions for insert and edit data, and im using the alert controller handler to archieve this process but i dont know how to pass objects to reuse same code for all my cruds, here are the 2 functions i want to use as service for all my others pages:

Insert data:

async insertarData() {
const alert = await this.uiService.alertController.create({
header: ‘Agregar nueva actividad’,
inputs: [
{
name: ‘nombreActividad’,
type: ‘text’,
placeholder: ‘Ingrese actividad’
}
],
buttons: [
{
text: ‘Cancel’,
role: ‘cancel’,
cssClass: ‘secondary’
}, {
text: ‘Crear’,
handler: data => {
this.actividad.nombreActividad = data[‘nombreActividad’];
this.crearActividad();
}
}
]
});

await alert.present();

}

Edit data:

async editarActividad(){

  const alert = await this.uiService.alertController.create({
    header: 'Agregar nueva actividad',
    inputs: [
      {
        name: 'nombreActividad',
        value: this.actividad.nombreActividad ,
        type: 'text',
        placeholder: 'Ingrese actividad'
      }
    ],
    buttons: [
      {
        text: 'Cancel',
        role: 'cancel',
        cssClass: 'secondary'
      }, {
        text: 'Crear',
        handler: data => {
          this.actividad.nombreActividad = data['nombreActividad'];
           this.actividadService.actualizarPorId(this.actividad.id, this.actividad.nombreActividad).subscribe(
           res => this.uiService.presentToast(res['message']),
           error => this.uiService.alertaInformativa(error)
           );        
        }
      }
    ]
  });

  await alert.present();
}

every comment and advice are totally welcome.

thanks in advance.