I have a problem with my API.
So when I'm in my IDE and run my code through ng serve and dotnet run everything works fine and I get values in my backend. But when I publish my code and try it on my server the FromBody var is null.
Also in the Chrome Dev Tools, I see the values in the Request Payload.
Why the Oberservable? Because that is my result and I do not know the other way.
Broken API
Working in IDE but not when published
My TypeScript
signupUser(user: User): Observable<boolean> {
return this.http.post<boolean>('api/user/signupuser', user);
}
My C#
[HttpPost]
public bool SignUpUser([FromBody]User user)
{
return UserBusinessLayer.SignUpUser(user);
}
Working API
Working in IDE and when published
TypeScript
loginUser(email: string, password: string): Observable<boolean> {
return this.http.post<boolean>('api/user/loginuser', {email: email, password: password});
}
C#
[HttpPost]
public bool LoginUser([FromBody]User user)
{
return UserBusinessLayer.LoginUser(user);
}