-1
In my project, I have to send a file to my backend, but when I get to the back it doesn’t take my parameters, it’s probably a problem in my service.
follow my ts and service.
TS:
sendMailing() {
this.dashboardService.sendMailing(this.mailing, this.infoUser.Id).subscribe(res => {
console.log(res)
});
}
Service:
sendMailing(file, id) {
var parms = {"mailing": file, "userId": id};
let headers = new Headers({ 'Content-Type': 'multipart/form-data' });
let options = new RequestOptions({ headers: headers });
return this.http
.post(environment.fastzapUrl + "v1/user/mailing", parms, options)
.map((res: Response) => res.json())
}
Hello, add more details about the error. I recommend to reading
– renanvm
When it arrives on the back, have two variables waiting for the parameters to run, but it passes straight, then I treated to return an error msg
– Renan Santos
What is the status code returned? What is the error message?
– renanvm
the message was set by me, returns a string with a phrase pro user, not giving error in the process, the only problem is that it goes through the variables and does not save the parameters then it falls in the condition I did and returns the message I set pro user
– Renan Santos