本文整理匯總了TypeScript中services/session.Session類的典型用法代碼示例。如果您正苦於以下問題:TypeScript Session類的具體用法?TypeScript Session怎麽用?TypeScript Session使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Session類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: alert
this.ds.login(name, pwd).then(user => {
if (user) {
this.session.setUser(user);
this.router.navigateToRoute("dispatch");
} else {
alert("Interner Fehler: Login misslungen");
}
});
示例2:
return this.ds.login().then(user => {
if (user) {
this.session.setUser(user);
return this.router.navigateToRoute("dispatch");
} else {
return true;
}
});
示例3: activate
public async activate() {
try {
log.info("Got response from OAuth")
const result = await this.fhir.getSmartclient();
log.info("Loaded Smart client")
sessionStorage.setItem("ch.webelexis.logintoken", result);
// alert("we are logged in!");
// TODO: Set correct user
this.session.setUser({
id: "admin@webelexis.ch",
roles: ["admin", "guest", "user", "mpa"]
});
this.router.navigateToRoute("dispatch");
} catch (err) {
log.error("Smartclient failed: %s", err)
alert("SmartClient failed " + err);
}
}
示例4: logout
public logout() {
this.session.logout().then(loggedOut => {
this.router.navigate("/");
});
}