本文整理汇总了TypeScript中lib/services/authService.AuthService类的典型用法代码示例。如果您正苦于以下问题:TypeScript AuthService类的具体用法?TypeScript AuthService怎么用?TypeScript AuthService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AuthService类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(private _router:Router,
private _authService:AuthService) {
this.show = {
alert: false,
smoothAlert:false
};
this._authService.getCurrentUser()
.subscribe(success => {
this.user = success;
}, error => {});
}
示例2: constructor
constructor(private _router:Router,
private _authService:AuthService,
private _formBuilder:FormBuilder) {
this.userForm = this._formBuilder.group({
'first_name': ['', Validators.required],
'last_name': ['', Validators.required],
'about': ['', Validators.required],
'phone': ['', Validators.required],
'age': ['', Validators.required]
});
this.show = {};
// Initializes the current user
this._authService.getCurrentUser()
.subscribe(success => {
// The request was a success
this.user = success;
}, error => {
// Something went wrong
console.log(error);
});
}
示例3: sendNewSMS
public sendNewSMS() {
var email = this._routeSegment.getParam('phone');
this._authService.resendConfirmEmail(email)
.subscribe(res => {
console.log('New email sent');
});
}
示例4: validataAuthToken
public validataAuthToken() {
let token = this._routeSegment.getParam('token');
this._authService.validateToken(token)
.subscribe(res => {
this.alertText = 'Bekreftet!';
this.toggle('alert');
setTimeout(() => {
this.toggle('alert');
this._router.navigate(['login']);
}, 2000)
});
}
示例5: update
/*
* ==================================
* PUBLIC METHODS
* ==================================
*/
// Update user information
public update() {
// Sets the profile to compleated, since all fields in form needs to be valid for this function to be triggered
this.user.has_completed_profile = true;
this._authService.update(this.user)
.subscribe(success => {
console.log("Success");
this.alertOptions = {
title: 'Oppdatert',
showAccept: true,
acceptText: 'Lukk',
type: 'success',
text: 'Din profil er nĂĽ oppdatert. Takk skal du ha.'
};
this.toggle('alert');
}, error => {
});
}
示例6: verifyCode
public verifyCode(code:string) {
this._authService.validateCode(code)
.subscribe(success => {
this._router.navigate(['front']);
}, error => {});
}