Ionic 3 : error message : "The expected type comes from property 'message' which is declared here on type 'ToastOptions' "

Viewed 3085

Can anybody help me?

I'm new in Ionic3 and i want to try to make page login and Logout. I try this code and get error message like this:

The expected type comes from property 'message' which is declared here on type 'ToastOptions'

How should I do to solve this case?

Thank u

import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams, ToastController } from 'ionic-angular';
import { HomePage } from '../home/home';

import { AuthProvider } from '../../providers/auth/auth';


@IonicPage()
@Component({
  selector: 'page-login',
  templateUrl: 'login.html',
})
export class LoginPage {
  credentials:any = {
      username : "",
      password : ""
  }

  constructor(public navCtrl: NavController, public navParams: NavParams, public auth:AuthProvider,public toastCtrl:ToastController) {
  }

  ionViewDidLoad() {
    let status = localStorage.getItem("isLogin");
    if (status == "true"){
      this.navCtrl.setRoot(HomePage);
    }
  }

  login()
  {
    this.auth.login(this.credentials).then((resp) => {
      let toast = this.toastCtrl.create({
        message: resp,
        duration:3000,
        position:'buttom'
      });
      toast.present();
      this.navCtrl.setRoot(HomePage);
    }).catch((err) => {
      let toast = this.toastCtrl.create({
        message: err,
        duration:2000,
        position:'buttom'
      });
      toast.present();
    })
  }

}

Fullsize image

0 Answers
Related