'In Strapi, previously we had to use { payload } to post but now we have to use {data { payload } } how do I post using Angular anyone could help plzzz
This is my service.ts file
addOrder(data:Order):Observable<any> {
let API_URL=`${strapiendpoint}/orders`;
return this.http.post(API_URL,data,httpOptions)
.pipe(
catchError(this.errorMgmt)
)
}
This is my component.ts file where I am posting the data through service
createOrder() {
this.strapiService.addOrder(this.form.value)
.pipe(first())
.subscribe({
next: () => {
this.alertService.success('Order added successfully');
},
error: error => {
this.loading = false;
}
});
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
