вот мой код
products.service:
updateCategorie(ucategorie: Icategorie) {
const endpoint = this.url + 'api/Category/Edit';
const headers = new Headers();
headers.append('Authorization', 'Bearer ' + localStorage.getItem('access_token'));
const options = new RequestOptions({
headers: headers
});
console.log('access_toke: ', localStorage.getItem('access_token'));
return this.http.put(endpoint, ucategorie, options)
.pipe(map((res) => {
return res.json();
})).toPromise();
все поля не равны нулю и токен доступа отправляется product.component.ts:
updateCategorie() {
this.spinner.show();
console.log('catudata: ', this.categorieudata.value);
this.authent.updateCategorie(this.categorieudata.value).then((res) => {
if (res) {
this.spinner.hide();
if (confirm(this.categorieudata.value.Category_name + 'have been updated')) {
this.ngOnInit();
}
}
}, (err) => {
this.spinner.hide();
if (confirm('An error occured please try again')) {
this.ngOnInit();
console.log('###error: ', err);
}
});
}
но я получаю эти ошибки:
Access to XMLHttpRequest at 'http://api-accountingsystem.azurewebsites.net/api/Category/Edit' from origin 'http://localhost:4200' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
, и я использовал тот же метод для другого запроса, который сработал, может кто-нибудь помочь мне, пожалуйста