Store Firebase newuser UID in mysql using ionic


#1

reg.ts fine

import { AngularFireAuth } from 'angularfire2/auth';
import { ApiProvider } from './../../providers/api/api';

public user:User = new User();
  myForm
  firebaseid: any;

async register() {
    try {
      var r = await this.fAuth.auth.createUserWithEmailAndPassword(
        this.user.email,
        this.user.password
      ).then((newUser:any) => {
          var firebaseid = (newUser.user.uid)
          console.log(firebaseid);
          //console.log(newUser.user.uid)
          console.log("Successfully registered!");
          this.apiProvider.SaveFirebaseId(this.firebaseid).then((result) => {
            console.log(result);
          }, (err) => {
            console.log(err);
          });
          this.presentToast();
        });

    }catch (error) {
        if (error.code !== "") {
          if(error.code == "auth/email-already-in-use"){
            let alert = this.alertCtrl.create({
              title: 'Email Exists',
              subTitle: 'The email you entered is already registered.',
              buttons: ['Retry']
            });

            alert.present();
          }
        console.error(error);
      }
    }
  }

api.ts file

baseUrl = 'url';
SaveFirebaseId(data) {
    let headers = new Headers();
    headers.append('Content-Type', 'application/json');

    return new Promise((resolve, reject) => {
      this.http.post(this.baseUrl+'/insert_reg.php', JSON.stringify(data))
        .subscribe(res => {
          resolve(res);
          console.log(res)
        }, (err) => {
          reject(err);
        });
    });
  }

How can i store firebase new user id in mysqli database at signup new user with fire base in ionic