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
|
|
|
|
2022-04-16 09:47:30 +02:00
|
|
|
export type MediaType = 'application/json' | 'text/plain'
|
2017-12-19 13:53:46 +01:00
|
|
|
|
2019-03-18 13:58:02 +01:00
|
|
|
export class CustomOptions {
|
2022-04-16 09:47:30 +02:00
|
|
|
|
|
|
|
public static registryOptions(mediaType: MediaType = 'application/json'): {} {
|
|
|
|
let httpHeaders = new HttpHeaders({
|
|
|
|
'Content-Type': mediaType,
|
|
|
|
});
|
|
|
|
return {headers: httpHeaders, withCredentials: true};
|
|
|
|
}
|
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
|
|
|
|
2022-04-16 09:47:30 +02:00
|
|
|
}
|