Created
September 19, 2019 23:47
-
-
Save slooock/c2474a43bce2767e0c57f56d4bd78a94 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const [values, setValues] = React.useState({ | |
id: '', | |
name : "", | |
email: "", | |
cpf: "", | |
telephone: [], | |
birthData: "", | |
office: "", | |
address: "", | |
complement: "", | |
}); | |
useEffect(() => { | |
async function loadEmployee(){ | |
let employeeId = props.location.pathname.toLocaleString().split(':')[1].substring(3, 23); | |
const usuario = await props.firebase.doSearchIdInsert('Users', employeeId); | |
const user = {id: employeeId, ...usuario}; | |
await setValues(user); | |
setValues({...values,["telephone"]:user.telephone}); | |
console.log(user.telephone); | |
} | |
loadEmployee().then(()=>{console.log(values)}); | |
},[]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment