I am experiencing an issue while sending data to an API using a post method. I have structured the data in an object as per the server's requirements, but upon posting the object to the API, I receive a response with a status of 200 and an empty array. Is the response supposed to be similar to the "Response samples" shown in the print screen?
The service where the post request is made:
voteGame(vote:vote) {
const body = vote;
return this.http.post<vote>('https://api-labs.tindin.com.br/games/rate', body).subscribe(data => console.log(data));
}
The model created for the object is as follows:
export interface vote {
gameId: string;
rate: number;
}
The function that triggers the service call:
voteGame(vote: number) {
const voteObj = {
gameId: this.gameId,
rate: vote,
};
console.log(voteObj);
this.voteGameService.voteGame(voteObj);
}