I am working on Angular application. My backend returns 403 error.
catch (AccessViolationException ex)
{
return StatusCode(403, ex.Message);
}
On my frontend, my component.ts has subscribed to the method. But its not running error block. It should show error in snackbar but it is not going in error block. I can see Http error in console.
this.dataSource.deleteUser(_data.id).subscribe(
(result) => {
if (result.Status) {
this.loadItems(false);
this.snackbarService.show(_deleteMessage, 'success');
this.selection.clear();
} else {
this.snackbarService.show(_message, 'danger');
}
},
(error) => {
this.snackbarService.show(error.error.Message, 'danger');
}
);
where DataSource class contains
deleteUser(_id: number): Observable<any> {
return this.service.deleteUser(_id);
}
And service class contains
deleteUser(id: number): Observable<any> {
return this.httpService.delete('/Admin/DeleteUserRequest/' + id);
}