Currently, I am working with a code that contains nested subscribes:
.subscribe((data) => {
const { game, prizes } = data;
this.ticketService.setListOfTickets(game.tickets);
this.ticketService.getListOfTickets()
.subscribe((data: any) => {
this.listOfTickets = data;
});
this.game = game;
this.type = game.type;
this.combinations = prizes.map((el: Prize) => el.patterns).flat();
});
Is there a way to restructure this code in order to eliminate the need for nested subscriptions?