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

34 lines
884 B
TypeScript

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