设置客户端进行注册。 这是注册客户端的功能。
table{
width:100%;
}
td {
width:50%;
float:left;
padding:0;
margin:0;
text-overflow:ellipsis;
white-space:nowrap;
overflow:hidden;
}
这是为了显示注册到控制台后服务器的响应。
registerAsClient(){
this.loading =this.loadingCtrl.create({
content:"Setting up Account"
});
this.loading.present();
this.buildClientData();
console.log(this.clientData);
this.auth.store('clients', this.clientData).subscribe((response)=>{
this.clients = response.json();
这是来自控制台注册的响应 我可以获取客户ID,但储蓄帐户ID显示为未定义。
console.log("Client ID : " + this.clients['clientId']);
console.log("Savings Account ID : " + this.clients['savingsAccountId']);
localStorage.setItem('clientID', this.clients['clientId']);
localStorage.setItem('officeID', this.clients['officeId']);
localStorage.setItem('savingsAccountID', this.clients['savingsAccountId']);
setTimeout(()=>{
this.loading.dismissAll();
this.toastrCtrl.messenger('Successfully Registered');
localStorage.setItem('registered', 'true');
this.navCtrl.push(HomePage);
},5000)
},error=>{
if(error.status === 403){
this.loading.dismissAll();
this.toastrCtrl.messenger("Phone number already exists. Please use another");
}else
this.loading.dismissAll();
this.toastrCtrl.messenger('Service unavailable. Please try again later');
console.log(error);
// alert(JSON.stringify("Error is :" + error));
})
}
使用端点进行测试时,总Client ID : 104
Savings Account ID : undefined
响应。
json
谢谢。