Property 'status' does not exist on type 'void'

Please help me to solve this problem. i want to get json response from api in partnerservice file. and from my login.ts i want to get the response from service but i get this error message

this is the code
login.ts
onLogin(){
if(!this.email){
this.nav.present(this.alert(‘Maaf Email Belum Diisi’));
}else if(!this.password){
this.nav.present(this.alert(‘Maaf password belum diisi’));
}else{
let data_login = JSON.stringify({
email: this.email,
password: this.password
});
let a = this.partnerService.login(data_login);
this.nav.present(this.setloading());
if(a.status=1){
console.log(‘success’);
}else{
console.log(‘error’);
}

    }
  }

partnerService
login(data_login){
let url= this.apiUrl + “PartnerLogin/” + this.apiKey;
this.http.post(url, data_login)
.map(res => res.json())
.subscribe(data => {
this.data = data;
return this.data;
});

  }

Please format your code by using three backticks at the top and bottom so it is easier to read. One issue with your code is that you are trying to handle asynchronous data synchronously.

Your login function in the partnerService should return a promise that resolves when the post request completes, and then you should call it like this:

this.partnerService.login(data_login).then((res) => {
   if(res.status == 1){

  } else {

 }
});

Also another issue is that you currently have:

if(a.status = 1)

which is an assignment operation, not a comparison, so that will always return true and assign 1 to a.status. Needs to be ==.