Created
September 19, 2019 23:47
-
-
Save slooock/78246ac70846804f497e8a601d90f38d to your computer and use it in GitHub Desktop.
This file contains 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