Код не выполняется в Ionic после метода post - PullRequest
0 голосов
/ 03 июня 2019

Я опубликовал в своем API, и все работает (получение сетевого класса и т. Д.).Однако после вызова метода остальная часть кода не выполняется.

Login.ts 

login() {
    this.authService.login(this.email, this.pw).subscribe(result => {
      if (result) {
        console.log('Working');
        this.presentLoading();
        // store jwt
        // move to dashboard
        console.log('Valid User');
        this.navCtrl.navigateForward('/menu/first/tabs/tab1');
        this.router.navigate(['/menu/first']);
          }
      },  error => {
          if (error.status === 401) {
            console.log('Authorisation Required');
          }
        }
      );
  }


auth-service.ts

login(email, pw) {
  if (email === '' || pw === '') {
    this.presentAlert();
  } else {
  const params = new HttpParams()
  .set('email', email)
  .set('pw', pw);
  return this.http.post<any>(apiUrl + 'login', {email, pw}, {params});
  }
}

1 Ответ

0 голосов
/ 03 июня 2019

Попробуйте это:

login(email, pw) {

  return this.http.get(apiUrl + "login?"+"email="+email+"pw="+pw)
         .map(res => res.json())
  }
}

подтвердить адрес электронной почты и пароль в login.ts

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...