Created
December 28, 2019 21:29
-
-
Save wilsonjuniordeveloper/fd67b09947243bb998c225672f412791 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
import React, {useState} from 'react'; | |
import {Container, Input, Button, Title} from './styles' | |
import firebase from '../data/Firebase'; | |
export default function Login() { | |
const [email, setEmail] = useState(''); | |
const [pass, setPass] = useState(''); | |
const login = () => { | |
firebase.auth().signInWithEmailAndPassword(email, pass).then(user => { | |
console.log(user) | |
}) | |
} | |
const cadastro = () => { | |
firebase.auth().createUserWithEmailAndPassword(email, pass).then(user => { | |
console.log(user) | |
}) | |
} | |
return ( | |
<Container> | |
<Title>Seja bem vindo, faça login para continuar </Title> | |
<Input type="email" placeholder="Informe seu email" | |
value={email} onChange={e=> setEmail(e.target.value)} | |
/> | |
<Input type="password" placeholder="Informe sua senha" | |
value={pass} onChange={e=> setPass(e.target.value)} | |
/> | |
<Button onClick={login}> Entrar com e-mail agora </Button> | |
<Button primary onClick={cadastro}> Cadastre com e-mail agora </Button> | |
</Container> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment