As a newcomer to angular, I am currently in the process of setting up my authorization module for an ionic project I am developing.
I have made significant progress, but I have encountered an issue with the 'auth' service that I created.
Within my auth.service, I have implemented the following login method:
login(user){
this.http.post(this.API_ENDPOINT+'/authenticate', user)
.map(res => res.json())
.subscribe(user => {
this.storeUserCredentials(user);
return user;
})
}
When attempting to call this method within my login.ts component:
constructor(public navCtrl: NavController, public navParams: NavParams, private auth: AuthenticationProvider) {
}
ionViewDidLoad() {
console.log('ionViewDidLoad LoginPage');
}
userLogin(f){
this.auth.login(f.value)
.subscribe(response => {
this.navCtrl.push('TabsPage');
})
}
}
An error is flagged with a red line under '.subscribe' showing the message:
[ts] Property 'subscribe' does not exist on type 'void'.
any
It's worth noting that my ultimate objective is to make a request to the authenticate endpoint, then execute the "storeUserCredentials()", and finally navigate to the tabs page.