I am facing an issue with refreshing the table in my component using the following function:
this._empresaService.getAllEnterprisePaginated(1);
. This function is located in my service, specifically in the modal service of the enterprise component.
CODE for the enterprise component
createEnterprise() {
this._empresaService.createNewEnterprise(this.imagenSubir, this.enterprise_name)
.then((resp: any) => {
resp = JSON.parse(resp);
if(resp.out == 1) {
this.toastr.error('La empresa ' + this.enterprise_name + ' ya se encuentra registrada en el sistema', 'Error!', {
positionClass: 'toast-bottom-left',
progressBar: true
});
return;
} else {
this.toastr.success('La empresa ' + this.enterprise_name + ' fue creada exitosamente', 'Empresa creada!', {
positionClass: 'toast-bottom-left',
progressBar: true
});
this.cerrarModal();
// this._empresaService.getAllEnterprisePaginated(1);
// for (let i = 0; i < this._empresaService.allEnterprise.length; i++) {
// var emp : Enterprise = this._empresaService.allEnterprise[i]
// }
}
});
}
CODE for the ENTERPIRSE MODAL SERVICE
getAllEnterprisePaginated(init_page: any = 1) {
let page = {init_page: init_page}
let url = URL_SERVICIOS + '/getallenterprise';
return this.http.post(url, page)
.pipe(map((resp: any) => {
this.allEnterprise = resp.recordset
return resp;
}));
}
The function I added is not functioning as expected.