0
My code is like this:
import React from 'react';
import './addAssalariado.css'
import * as firebase from "firebase/app";
export default function addAssalariado(){
function add(){
var name = document.getElementsByName("nome");
var endereço = document.getElementsByName("endereço");
var salario = document.getElementsByName("salario");
firebase.datebase().ref('myemployees/employees/'+1).set({
name: name,
address: endereço,
salay: salario
});
}
return(
<form id="comments_form" action="#" method="post">
<fieldset>
<legend>Dados do Empregado Assalariado</legend>
<p>
<label for="nome">Nome:</label>
<input name="nome" id="nome" type="text" />
</p>
<p>
<label for="endereço">Endereço:</label>
<input name="endereço" id="endereço" type="text" />
</p>
<p>
<label for="salario">Salário:</label>
<input name="salario" id="salario" type="text" />
</p>
</fieldset>
<p><input id="submit" name="submit" type="submit" onClick={add}/></p>
</form>
);
}
When I press the send button appears the message on the screen:
Cannot POST /addAssalariado
My tree at firebase is like this:
payroll-ba15c
myemployees
employees: 1
Hi, now the following error Typeerror: firebase_app__WEBPACK_IMPORTED_MODULE_2__.datebase is not a Function pointing to the line: firebase.datebase(). ref('myemployees/Employees'). push(). set({
– Kamilla
@Kamilla, edited, try so
– Anderson Henrique
Thanks guys for the tips, but I chose to use the Cloud Firestore and got it. Thanks really.
– Kamilla