Skip to content

Instantly share code, notes, and snippets.

@wilsonjuniordeveloper
Created December 28, 2019 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wilsonjuniordeveloper/fd67b09947243bb998c225672f412791 to your computer and use it in GitHub Desktop.
Save wilsonjuniordeveloper/fd67b09947243bb998c225672f412791 to your computer and use it in GitHub Desktop.
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