本文整理汇总了TypeScript中ng2-webstorage.SessionStorageService类的典型用法代码示例。如果您正苦于以下问题:TypeScript SessionStorageService类的具体用法?TypeScript SessionStorageService怎么用?TypeScript SessionStorageService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SessionStorageService类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: requestIntercept
requestIntercept(options?: RequestOptionsArgs): RequestOptionsArgs {
const token = this.localStorage.retrieve('authenticationToken') || this.sessionStorage.retrieve('authenticationToken');
if (token && token.expires_at && token.expires_at > new Date().getTime()) {
options.headers.append('Authorization', 'Bearer ' + token.access_token);
}
return options;
}
开发者ID:ororker,项目名称:testy,代码行数:7,代码来源:auth.interceptor.ts
示例2: storeAuthenticationToken
storeAuthenticationToken(jwt, rememberMe) {
if (rememberMe) {
this.$localStorage.store('authenticationToken', jwt);
} else {
this.$sessionStorage.store('authenticationToken', jwt);
}
}
开发者ID:alv-ch,项目名称:job-room,代码行数:7,代码来源:auth-jwt.service.ts
示例3: requestIntercept
requestIntercept(options?: RequestOptionsArgs): RequestOptionsArgs {
const token = this.localStorage.retrieve('authenticationToken') || this.sessionStorage.retrieve('authenticationToken');
if (!!token) {
options.headers.append('Authorization', 'Bearer ' + token);
}
return options;
}
开发者ID:BadgerPc,项目名称:jhipster-microservices-example,代码行数:7,代码来源:auth.interceptor.ts
示例4: canActivate
canActivate() {
console.log('LogoutGuard#canActivate called');
if(this.loginService.isAuthenticated) {
this.sessionSt.clear('user');
this.router.navigate(['/']);
}
return true;
}
开发者ID:venkataramkishore,项目名称:angular2rxjs,代码行数:8,代码来源:logout.guard.ts
示例5: storeDestinationState
storeDestinationState(destinationState, destinationStateParams, fromState) {
const destinationInfo = {
'destination': {
'name': destinationState.name,
'data': destinationState.data,
},
'params': destinationStateParams,
'from': {
'name': fromState.name,
}
};
this.$sessionStorage.store('destinationState', destinationInfo);
}
开发者ID:BadgerPc,项目名称:jhipster-microservices-example,代码行数:13,代码来源:state-storage.service.ts
示例6: storeDestinationState
storeDestinationState(destinationState: StateDeclaration, destinationStateParams, fromState: StateDeclaration) {
let destinationInfo = {
'destination': {
'name': destinationState.name,
'data': destinationState.data,
'parent': destinationState.parent
},
'params': destinationStateParams,
'from': {
'name': fromState.name,
'data': fromState.data,
'parent': fromState.parent
}
};
this.$sessionStorage.store('destinationState', destinationInfo);
}
开发者ID:JimSpriggs,项目名称:sourdough,代码行数:16,代码来源:state-storage.service.ts
示例7: ngOnInit
ngOnInit(): void {
this.storage.observe('user')
.subscribe((newValue:User) => {
console.log(newValue);
if(newValue) {
this.navbarService.changeToUserMenu(newValue);
}else {
this.navbarService.changeToDefaultMenu();
}
});
this.navbarService.getNavbarMenu().subscribe(
(navMenu)=> {
this.navMenu = navMenu;
}
);
}
开发者ID:venkataramkishore,项目名称:angular2rxjs,代码行数:18,代码来源:navbar.component.ts
示例8: getToken
getToken() {
return this.$localStorage.retrieve('authenticationToken') || this.$sessionStorage.retrieve('authenticationToken');
}
开发者ID:alv-ch,项目名称:job-room,代码行数:4,代码来源:auth-jwt.service.ts
示例9: getDestinationState
getDestinationState() {
return this.$sessionStorage.retrieve('destinationState');
}
开发者ID:JimSpriggs,项目名称:sourdough,代码行数:3,代码来源:state-storage.service.ts
示例10: resetPreviousState
resetPreviousState() {
this.$sessionStorage.clear('previousState');
}
开发者ID:JimSpriggs,项目名称:sourdough,代码行数:3,代码来源:state-storage.service.ts
注:本文中的ng2-webstorage.SessionStorageService类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论