33 lines
912 B
TypeScript
33 lines
912 B
TypeScript
import {COOKIE} from '../../login/utils/helper.class';
|
|
import {HttpHeaders} from "@angular/common/http";
|
|
|
|
|
|
export class CustomOptions {
|
|
|
|
public static registryOptions(body = true): {} {
|
|
let httpHeaders = new HttpHeaders();
|
|
if(body) {
|
|
httpHeaders.set('Content-Type', 'application/json');
|
|
}
|
|
return {headers: httpHeaders, 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():{} {
|
|
return {
|
|
headers: new HttpHeaders({
|
|
'X-XSRF-TOKEN': (COOKIE.getCookie(COOKIE.cookieName_id)) ? COOKIE.getCookie(COOKIE.cookieName_id) : ''
|
|
}), withCredentials: true
|
|
};
|
|
}
|
|
|
|
}
|