I am trying to call an existing API that returns a ID and Name as a Number and String and use the ID to route to different pages, but not sure where I am going wrong
ngOnInit(): void {
this.getData();
// calling the coach-interaction service getCategories endpoint
// use response to work out the flow based on the the conditionals of the issue
// if categories count = 0 then error
// if (categoryID == 0){
// this.appService.openSnackBar('You don not have access to this Service');
// }else if (categoryID == 1){
// // if categories count = 1 then set the category id in the payload and route to that category
// } else if (categoryID > 1) {
// // if categories count > 1 then show this component/page
// }
}
goBackTo = () => this.router.navigate([`${appRoutesNames.COACH_INTERACTION}/${coachInteractionRouteNames.MATCH_MAKING}`]).then();
getData = () =>{
this.http.get(this.coachService.GetCategories().subscribe)
.map((res:Response) => (
res.json()
))
.subscribe((data: any) => {console.log(data)})
}