32 lines
945 B
TypeScript
32 lines
945 B
TypeScript
import {COOKIE} from '../../login/utils/helper.class';
|
|
import {HttpHeaders} from "@angular/common/http";
|
|
|
|
export type MediaType = 'application/json' | 'text/plain'
|
|
|
|
export class CustomOptions {
|
|
|
|
public static registryOptions(mediaType: MediaType = 'application/json'): {} {
|
|
let httpHeaders = new HttpHeaders({
|
|
'Content-Type': mediaType,
|
|
});
|
|
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
|
|
};
|
|
}
|
|
|
|
} |