openaire-library/services/servicesUtils/customOptions.class.ts

23 lines
758 B
TypeScript

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