I want to replace subscribe in subscribe by switchMap, i dont know how to do that. I need 1 example, but i didn't find it on the Internet.
dialogRef.afterClosed().pipe(filter(result => !!result)).subscribe(result => {
result.owner = this.user.id;
proj._newname = result.name;
proj.name = result.name;
this.projectService.updateProject(proj, result.name)
.subscribe(project => {
const pw = new ProjectWorker({
approve: true,
worker: this.user.id,
project: project.id,
admin: true,
write: true
});
this.projectService.createProjectWorker(pw).subscribe(_ => {
this.getProjects();
});
},
err => {
this._snackbar.open('Project already exist', 'error', {
panelClass: 'snackbar-error'
})
});
}
);