本文整理汇总了TypeScript中ngx-Webstorage.SessionStorageService类的典型用法代码示例。如果您正苦于以下问题:TypeScript SessionStorageService类的具体用法?TypeScript SessionStorageService怎么用?TypeScript SessionStorageService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SessionStorageService类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(
private _script: ScriptLoaderService,
private sessionStorage: SessionStorageService,
private principal: Principal,
private publicService: PublicService) {
this.ctx = publicService.getServiceCtx('sys_module')
this.nodeId = sessionStorage.retrieve("tree_module_select_node_id"), this.nodeId = (this.nodeId) ? this.nodeId : 1
}
示例2: getLimit
getLimit() //sends list of registration forms to panelist
{
console.log(this.sstorage.retrieve('username'));
return this.http.get('assets/data/limit.json')
// return this.http.get('panelist/'+this.userName) //getting UserType
.flatMap((data) =>data.json());
}
示例3: storeAuthenticationToken
storeAuthenticationToken(jwt, rememberMe) {
if (rememberMe) {
this.$localStorage.store('authenticationToken', jwt);
} else {
this.$sessionStorage.store('authenticationToken', jwt);
}
}
示例4: getUser
public getUser(): User {
if (typeof this._user === 'undefined' || this._user === null) {
const userFromSessionStorage: User = this.sessionStorage.retrieve(
'user'
);
if (
typeof userFromSessionStorage === 'undefined' ||
userFromSessionStorage === null
) {
this.router.navigate(['logout']);
} else {
this._user = userFromSessionStorage;
return this._user;
}
} else {
// check if user is still valid
if (moment(this._user.exp * 1000).isBefore(moment(Date.now()))) {
this.router.navigate(['logout']).then(() => {
setTimeout(() => {});
});
return undefined;
}
return this._user;
}
}
示例5: 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;
}
示例6: 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);
}
示例7: 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)
}
示例8: 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);
}
示例9: getPreviousState
getPreviousState() {
return this.$sessionStorage.retrieve('previousState');
}
示例10: getUrl
getUrl() {
return this.$sessionStorage.retrieve('previousUrl');
}