我需要帮助在Firebase中存储注册数据 . 我想在Firebase数据库中存储当前登录用户的电子邮件名称 . 请帮助我 . 我正在扭动代码,用户可以在其他用户的 Profiles 上写 .

//auth service

import { Injectable } from "@angular/core";
import { AngularFireAuth } from "@angular/fire/auth";
import { Observable } from "rxjs";
import "rxjs/add/operator/map";

@Injectable()
export class AuthService {
  constructor(private afAuth: AngularFireAuth) {}

  login(email: string, password: string) {
    return new Promise((resolove, reject) => {
      this.afAuth.auth
        .signInWithEmailAndPassword(email, password)
        .then(userData => resolove(userData), err => reject(err));
    });
  }
  getAuth() {
    return this.afAuth.authState.map(auth => auth);
  }
  logout() {
    this.afAuth.auth.signOut();
  }
  register(email: string, password: string) {
    return new Promise((resolove, reject) => {
      this.afAuth.auth
        .createUserWithEmailAndPassword(email, password)
        .then(userData => resolove(userData), err => reject(err));
    });
  }
}
**register component**
import { Component, OnInit } from "@angular/core";
import { AuthService } from "../../service/auth.service";
import { Router } from "@angular/router";

@Component({
  selector: "app-register",
  templateUrl: "./register.component.html",
  styleUrls: ["./register.component.css"]
})
export class RegisterComponent implements OnInit {
  email: string;
  password: string;
  constructor(private authService: AuthService, private router: Router) {}

  ngOnInit() {}

  onSubmit() {
    this.authService
      .register(this.email, this.password)
      .then(res => {
        this.router.navigate(["/"]);
      })
      .catch(err => console.log(err.message));
  }
}