本文整理汇总了TypeScript中ngx-Webstorage.LocalStorageService类的典型用法代码示例。如果您正苦于以下问题:TypeScript LocalStorageService类的具体用法?TypeScript LocalStorageService怎么用?TypeScript LocalStorageService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LocalStorageService类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: storeAuthenticationToken
storeAuthenticationToken(jwt, rememberMe) {
if (rememberMe) {
this.$localStorage.store('authenticationToken', jwt);
} else {
this.$sessionStorage.store('authenticationToken', jwt);
}
}
开发者ID:Doha2012,项目名称:tutorials,代码行数:7,代码来源:auth-jwt.service.ts
示例2: getDefaultClientId
getDefaultClientId() {
// if (typeof this.user == 'undefined') {
// this.getUserDetails();
// }
// return this.auth.getPayload().data.default_client_id;
return this.localstorage.retrieve('client_id');
}
开发者ID:megamtech,项目名称:angular-php-framework,代码行数:7,代码来源:authentication.service.ts
示例3: requestIntercept
requestIntercept(options?: RequestOptionsArgs): RequestOptionsArgs {
if (!options || !options.url || (/^http/.test(options.url) && !(SERVER_API_URL && options.url.startsWith(SERVER_API_URL)))) {
return options;
}
const token = this.localStorage.retrieve('authenticationToken') || this.sessionStorage.retrieve('authenticationToken');
if (!!token) {
options.headers.append('Authorization', 'Bearer ' + token);
}
return options;
}
开发者ID:lbuthman,项目名称:tasks-spring-angular,代码行数:11,代码来源:auth.interceptor.ts
示例4: intercept
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
if (!request || !request.url || (/^http/.test(request.url) && !(SERVER_API_URL && request.url.startsWith(SERVER_API_URL)))) {
return next.handle(request);
}
const token = this.localStorage.retrieve('authenticationToken') || this.sessionStorage.retrieve('authenticationToken');
if (!!token) {
request = request.clone({
setHeaders: {
Authorization: 'Bearer ' + token
}
});
}
return next.handle(request);
}
开发者ID:EugeneGoroschenya,项目名称:jhipster-sample-application,代码行数:15,代码来源:auth.interceptor.ts
示例5: if
.map((response) => {
// Extract version on header
const cacheVersion: string = response.headers.get('dmp-servercacheversion');
const responseJson: { [key: string]: string } = response.json();
if (responseJson.status === 'success' && this.getLanguageVersion(language) === cacheVersion) {
// If existed in cache go on
return this.localStorage.retrieve(AppConstant.LOCAL_STORAGE_KEY.CACHE_LANGUAGE + language);
} else if (typeof responseJson.status === 'string') {
console.warn('⚠️ Response from translation provider is not success');
console.warn(' response :', responseJson);
}
else {
console.debug(' Got new translation object');
this.setLanguageVersion(language, cacheVersion);
}
// return Language object
return response.json();
})
开发者ID:PoompisekK,项目名称:myWork,代码行数:20,代码来源:uearn-translation.provider.ts
示例6: Observable
return new Observable(observer => {
this.$localStorage.clear('authenticationToken');
this.$sessionStorage.clear('authenticationToken');
observer.complete();
});
开发者ID:Doha2012,项目名称:tutorials,代码行数:5,代码来源:auth-jwt.service.ts
示例7: getToken
getToken() {
return this.$localStorage.retrieve('authenticationToken') || this.$sessionStorage.retrieve('authenticationToken');
}
开发者ID:Doha2012,项目名称:tutorials,代码行数:3,代码来源:auth-jwt.service.ts
示例8:
.catch((error) => {
console.warn('⚠️ Error while loading translation :', error);
return Observable.of(this.localStorage.retrieve(AppConstant.LOCAL_STORAGE_KEY.CACHE_LANGUAGE + language));
});
开发者ID:PoompisekK,项目名称:myWork,代码行数:5,代码来源:uearn-translation.provider.ts
示例9:
complete: () => {
this.localstorage.clear('client_id');
this.user = null;
// UIService.notify('You have been logged out', 'info');
// $state.go('login');
}
开发者ID:megamtech,项目名称:angular-php-framework,代码行数:6,代码来源:authentication.service.ts
注:本文中的ngx-Webstorage.LocalStorageService类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论