I am trying to make a post request to an api. My intention is to trigger success if the operation goes through, but so far the function below does not work as expected.
I tried this:
this.Repository.getTokens(payload).subscribe({
complete: () => {
const message = `${payload.amount} test Lto sent!!`;
this.openSnackBar(message);
},
error: () => {
const message = `You cannot request tokens at this time!`;
this.openSnackBar(message);
},
});
Note I also tried using next instead of complete.