How to relate account to Realtime Database data in firebase

Asked

Viewed 25 times

0

I am developing for web, and I can create the user, but I have to attach more data than email and password. In case I need to store the name, surname and date of birth. How I can create this user and add this information for future use?

Follow my login code (but do not store other form information)

(function() {

    createUserButton.addEventListener('click', function() {
        if (senha.value === confirm_senha.value && email.value !== "" && senha.value.length >= 6) {
            /* Pegar dados do usuario */
            nome = document.querySelector('#nome');
            sobrenome = document.querySelector('#sobrenome');
            createUserButton = document.querySelector('#submit');
            email = document.querySelector('#email');
            data = document.querySelector('#data');
            senha = document.querySelector('#senha');
            confirm_senha = document.querySelector('#confirm-senha');

            firebase
                .auth()
                .createUserWithEmailAndPassword(email.value, senha.value);

            alert('Cadastrado com sucesso')

        } else {

            alert('Erro');

        }
    })
})();

Follow the image of the form: inserir a descrição da imagem aqui

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.