html-page-content.service: Added missing authorization headers for POST request.

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@54574 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2019-01-16 11:29:26 +00:00
parent 6d32a5ad44
commit 65dc971304
2 changed files with 7 additions and 5 deletions

View File

@ -3,6 +3,7 @@ import { Http, Response, Headers, RequestOptions } from '@angular/http';
import { Observable } from 'rxjs/Rx'; import { Observable } from 'rxjs/Rx';
import {COOKIE} from "../../openaireLibrary/login/utils/helper.class" import {COOKIE} from "../../openaireLibrary/login/utils/helper.class"
import { HtmlPageContent } from "../../domain/html-page-content"; import { HtmlPageContent } from "../../domain/html-page-content";
import { CustomOptions } from '../../openaireLibrary/services/servicesUtils/customOptions.class';
@Injectable() @Injectable()
export class HtmlPageContentService { export class HtmlPageContentService {
@ -25,12 +26,13 @@ export class HtmlPageContentService {
} }
updateHtmlPageContent(htmlPageContent: HtmlPageContent, adminToolsAPIURL:string) { updateHtmlPageContent(htmlPageContent: HtmlPageContent, adminToolsAPIURL:string) {
let headers = new Headers({'Content-Type': 'application/json'}); //let headers = new Headers({'Content-Type': 'application/json'});
let options = new RequestOptions({headers: headers}); //let options = new RequestOptions({headers: headers});
HtmlPageContentService.removeNulls(htmlPageContent); HtmlPageContentService.removeNulls(htmlPageContent);
return this.http.post(adminToolsAPIURL + 'htmlpagecontent/update', JSON.stringify(htmlPageContent), options) return this.http.post(adminToolsAPIURL + 'htmlpagecontent/update', JSON.stringify(htmlPageContent), CustomOptions.getAuthOptionsWithBody())
//return this.http.post(adminToolsAPIURL + 'htmlpagecontent/update', JSON.stringify(htmlPageContent), options)
.map(res => <HtmlPageContent> res.json()) .map(res => <HtmlPageContent> res.json())
.catch(this.handleError); .catch(this.handleError);
} }

View File

@ -18,8 +18,8 @@ export class ManageUserNotificationsService {
} }
updateUserNotifications(url: string, userNotificationsRights: any) { updateUserNotifications(url: string, userNotificationsRights: any) {
let headers = new Headers({'Content-Type': 'application/json'}); //let headers = new Headers({'Content-Type': 'application/json'});
let options = new RequestOptions({headers: headers}); //let options = new RequestOptions({headers: headers});
let body = JSON.stringify(userNotificationsRights); let body = JSON.stringify(userNotificationsRights);
console.log(body); console.log(body);