ionic and laravel project, receiving and passing data with api token

  ionic-framework, laravel

I have been developing a project ionic 4 and laravel. the idea is to create user and the user will fill his info.

I used passport package for api in laravel.

In ionic project i create the authentication part and the info form page (which it didn’t work)

here is info page.ts

export class PersonalinfoPage{
  public personal_info : any;
  private loading : any;

  constructor(public navCtrl: NavController,
    private personalinfoService : PersonalinfoService,
    private errorsService : ErrorsService,
    private loadingCtrl : LoadingController,
    private modalController: ModalController,
    private authService: AuthService,
    private alertService: AlertService,
    public storage: Storage,
    public alertCtrl: AlertController, 
    public navParams: NavParams,
    public fb: FormBuilder, 
    public dataService: Data
    ) {
      this.personal_info = this.navParams.get('personal_info') || new Saudi();
    }
    ionViewDidLoad() {
      console.log('ionViewDidLoad CreateInfoPage');
    }
    addInfo() {
          let data = {
            personal_info: this.personal_info
          }
          this.personalinfoService.store( JSON.stringify( data ) ).subscribe(
            personal_info => {
              this.personal_info = personal_info;
              this.loading.dismiss();
              this.dismiss( true );
            },
            error => {
              console.log("error");
            }
          );
    }
  closeModal(){
    this.dismiss(false);
  }
  dismiss( returnParam : boolean ) {
    let data = { 'personal_info': this.personal_info, 'returnParam': returnParam };
  }
}

Source: Laravel

Leave a Reply