我有一个应用程序,我需要在登录前获取设备ID。所以无论如何都要使用angular获取设备的DeviceId
。请帮忙
TS:
login(value: any) {
let userName = value.email.trim();
let passWord = value.password.trim();
let password = Md5.hashStr(passWord)
let params = { username: userName, password: password }
this.authService.doLogin(params)
.subscribe((data: any) => {
if(data.Header.Message == "Please check accountId or password"){
this.msgs = [{ severity: 'error', summary: 'Error Message', detail: 'AccountId Or Password Is Incorrect' }];
}
else if(data.Header.Message == "Account is already deleted"){
this.msgs = [{ severity: 'error', summary: 'Error Message', detail: 'This user account is deleted from medicamind' }];
}
else if(Cookie.get("DeviceUID") != null){
alert("hi")
console.log(Cookie.get("DeviceUID"));
this.msgs = [{ severity: 'error', summary: 'Error Message', detail: 'This is not registered device, please login with sms/email authentication' }];
}
else if (data.Body.Data.token && data.Body.Data.id != -2) {
localStorage.setItem("userId_ls",data.Body.Data.userID)
localStorage.setItem('accountId_ls',data.Body.Data.accountID)
this.router.navigate(['/home']);
}
else {
}
})
}