本文整理汇总了TypeScript中ng2-ui-auth.Auth类的典型用法代码示例。如果您正苦于以下问题:TypeScript Auth类的具体用法?TypeScript Auth怎么用?TypeScript Auth使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Auth类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: makeGist
makeGist(params:any, next) {
if (this.auth.isAuthenticated()) {
this._token = this.auth.getToken();
}
let opts = this.getHttpOptions();
this.http.post(GithubService.url + '/gists', JSON.stringify(params), opts).subscribe(res => {
next(res.json());
});
}
示例2: getUser
getUser(next) {
if (this.auth.isAuthenticated()) {
this._token = this.auth.getToken();
}
let opts = this.getHttpOptions();
this.http.get(GithubService.url + '/user', opts).subscribe(res => {
next(res.json());
});
}
示例3: authenticate
authenticate(provider: string) {
this.auth.authenticate(provider)
.subscribe((res) => {
AuthService.setProvider(provider);
this.authService.loadUserInfo();
this.goToMain();
});
}
示例4: getRepository
getRepository(owner:string, repos:string) {
if (this.auth.isAuthenticated()) {
this._token = this.auth.getToken();
}
return new Repository(this.http, owner, repos, this);
}
示例5: constructor
constructor(private auth: Auth, private authService: AuthService, private router: Router){
if (this.auth.isAuthenticated() && AuthService.provider == 'github') {
this.goToMain();
}
}
示例6: authenticate
authenticate(provider: string) {
this.auth.authenticate(provider)
.subscribe(
//() => let abstract = 1;
// this.goToMain(),
//this.handlers.error
);
}