本文整理匯總了TypeScript中angular2-cookie/core.CookieService.getObject方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript CookieService.getObject方法的具體用法?TypeScript CookieService.getObject怎麽用?TypeScript CookieService.getObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類angular2-cookie/core.CookieService
的用法示例。
在下文中一共展示了CookieService.getObject方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: ngOnInit
ngOnInit() {
let cookieSotote = this._cookieService.getObject('blog-admin');
if (!cookieSotote){
let link = ['Login'];
this._router.navigate(link);
}
}
示例2: createAuthorizationHeader
private createAuthorizationHeader(headers?: Headers) {
let reqHeaders = headers || new Headers();
let user = this.getUser();
reqHeaders.set('Authorization', user.token);
reqHeaders.set('RefreshToken', user.refreshToken);
reqHeaders.set('Content-Type', 'application/json');
reqHeaders.set('Accept', 'application/json, text/plain, */*');
reqHeaders.set('Crds-Api-Key', process.env.ECHECK_API_TOKEN);
const machineConfig = MachineConfiguration.fromJson( this.cookie.getObject(MachineConfiguration.COOKIE_NAME_DETAILS) );
if (machineConfig) {
if (machineConfig.CongregationId) {
reqHeaders.set('Crds-Site-Id', machineConfig.CongregationId.toString());
}
if (machineConfig.KioskIdentifier) {
reqHeaders.set('Crds-Kiosk-Identifier', machineConfig.KioskIdentifier);
}
}
return reqHeaders;
}
示例3: getMachineDetailsConfigCookie
getMachineDetailsConfigCookie(): MachineConfiguration {
return MachineConfiguration.fromJson(this.cookieService.getObject(MachineConfiguration.COOKIE_NAME_DETAILS));
}
示例4: getMachineIdConfigCookie
getMachineIdConfigCookie(): any {
return this.cookieService.getObject(MachineConfiguration.COOKIE_NAME_ID);
}