2019-06-03 15:20:36 +02:00
|
|
|
import {COOKIE} from '../../login/utils/helper.class';
|
|
|
|
import {HttpHeaders} from "@angular/common/http";
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
|
2019-03-18 13:58:02 +01:00
|
|
|
export class CustomOptions {
|
2020-08-06 13:50:08 +02:00
|
|
|
|
2022-04-13 11:24:14 +02:00
|
|
|
public static registryOptions(body = true): {} {
|
|
|
|
let httpHeaders = new HttpHeaders();
|
|
|
|
if(body) {
|
|
|
|
httpHeaders.set('Content-Type', 'application/json');
|
|
|
|
}
|
|
|
|
return {headers: httpHeaders, withCredentials: true};
|
2020-08-06 13:50:08 +02:00
|
|
|
}
|
2019-03-18 13:58:02 +01:00
|
|
|
|
2019-06-03 15:20:36 +02:00
|
|
|
public static getAuthOptionsWithBody():{} {
|
|
|
|
return {
|
|
|
|
headers: new HttpHeaders({
|
|
|
|
'Content-Type': 'application/json',
|
2020-08-07 12:27:50 +02:00
|
|
|
'X-XSRF-TOKEN': COOKIE.getCookie(COOKIE.cookieName_id)?COOKIE.getCookie(COOKIE.cookieName_id):''
|
2019-06-03 15:20:36 +02:00
|
|
|
}), withCredentials: true
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2020-09-24 13:18:24 +02:00
|
|
|
public static getAuthOptions():{} {
|
2022-04-13 11:24:14 +02:00
|
|
|
return {
|
2019-06-03 15:20:36 +02:00
|
|
|
headers: new HttpHeaders({
|
2022-04-13 11:24:14 +02:00
|
|
|
'X-XSRF-TOKEN': (COOKIE.getCookie(COOKIE.cookieName_id)) ? COOKIE.getCookie(COOKIE.cookieName_id) : ''
|
2019-06-03 15:20:36 +02:00
|
|
|
}), withCredentials: true
|
|
|
|
};
|
|
|
|
}
|
2019-03-18 13:58:02 +01:00
|
|
|
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|