[Trunk|Library]: CustomOptions.class.ts: clear code

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@55005 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2019-03-18 12:58:02 +00:00
parent 10051a303e
commit ea267d003b
1 changed files with 13 additions and 10 deletions

View File

@ -2,18 +2,21 @@ import { RequestOptions, Headers} from '@angular/http';
import { COOKIE } from '../../login/utils/helper.class'; import { COOKIE } from '../../login/utils/helper.class';
export class CustomOptions{ export class CustomOptions {
public static getAuthOptionsWithBody():RequestOptions{
let headers = new Headers(); public static getAuthOptionsWithBody(): RequestOptions {
const headers = new Headers();
headers.append('Content-Type', 'application/json'); headers.append('Content-Type', 'application/json');
headers.append('X-XSRF-TOKEN', COOKIE.getCookie(COOKIE.cookieName_id)); headers.append('X-XSRF-TOKEN', COOKIE.getCookie(COOKIE.cookieName_id));
let options = new RequestOptions({ headers: headers, withCredentials:true }); const options = new RequestOptions({ headers: headers, withCredentials: true });
return options; return options;
} }
public static getAuthOptions():RequestOptions{
let headers = new Headers(); public static getAuthOptions(): RequestOptions {
const headers = new Headers();
headers.append('X-XSRF-TOKEN', COOKIE.getCookie(COOKIE.cookieName_id)); headers.append('X-XSRF-TOKEN', COOKIE.getCookie(COOKIE.cookieName_id));
let options = new RequestOptions({ headers: headers, withCredentials:true }); const options = new RequestOptions({ headers: headers, withCredentials: true });
return options; return options;
} }
} }