Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, { Component } from 'react';
- import firebase from 'firebase';
- import Config from './config';
- firebase.initializeApp(Config)
- Class RegisterLogin extends Component{
- constructor(props) {
- super(props);
- this.login = this.login.bind(this);
- this.handleChange = this.handleChange.bind(this);
- this.signup = this.signup.bind(this);
- this.state = {
- email: '',
- password:''
- };
- }
- handleChange(e){
- this.ListeningStateChangedEvent({ [e.target.name]: e.target.value});
- }
- login(e){
- e.preventDefault();
- firebase.auth().signInWithEmailAndPassword(this.state.email, this.state.password).then((u) => {}).catch((error) => {
- console.log(error);
- });
- }
- signup(e){
- e.preventDefault();
- firebase.auth().createUserWithEmailAndPassword(this.state.email, this.state.password).then((u) => {
- }).then((u)=>{
- console.log(u)
- }).catch((error) => {
- console.log(error);
- })
- }
- render(){
- return(
- <div className="App">
- <input value={this.state.email} onChange={this.handleChange} id="email" type="email" placeholder="email"></input>
- <input value={this.state.password} onChange={this.handleChange} id="password" type="password" placeholder="password"></input>
- <button onClick={this.login}>Login</button>
- <button onClick={this.signup}>Register</button>
- </div>
- )
- }
- }
- export default RegisterLogin;
- ./src/Register.js
- Line 7: Parsing error: Unexpected token, expected ";"
- 5 | firebase.initializeApp(Config)
- 6 |
- > 7 | Class RegisterLogin extends Component{
- | ^
- 8 | constructor(props) {
- 9 | super(props);
- 10 | this.login = this.login.bind(this);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement