SHARE
TWEET

Untitled

a guest Aug 19th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, { Component } from 'react';
  2. import firebase from 'firebase';
  3. import Config from './config';
  4.  
  5. firebase.initializeApp(Config)
  6.  
  7. Class RegisterLogin extends Component{
  8.     constructor(props) {
  9.         super(props);
  10.         this.login = this.login.bind(this);
  11.         this.handleChange = this.handleChange.bind(this);
  12.         this.signup = this.signup.bind(this);
  13.         this.state = {
  14.             email: '',
  15.             password:''
  16.         };
  17.     }
  18.  
  19.     handleChange(e){
  20.         this.ListeningStateChangedEvent({ [e.target.name]: e.target.value});
  21.     }
  22.     login(e){
  23.         e.preventDefault();
  24.         firebase.auth().signInWithEmailAndPassword(this.state.email, this.state.password).then((u) => {}).catch((error) => {
  25.             console.log(error);
  26.         });
  27.     }
  28.     signup(e){
  29.         e.preventDefault();
  30.         firebase.auth().createUserWithEmailAndPassword(this.state.email, this.state.password).then((u) => {
  31.         }).then((u)=>{
  32.             console.log(u)
  33.         }).catch((error) => {
  34.             console.log(error);
  35.         })
  36.     }
  37.     render(){
  38.         return(
  39.             <div className="App">
  40.                 <input value={this.state.email} onChange={this.handleChange} id="email" type="email" placeholder="email"></input>
  41.                 <input value={this.state.password} onChange={this.handleChange} id="password" type="password" placeholder="password"></input>
  42.                 <button onClick={this.login}>Login</button>
  43.                 <button onClick={this.signup}>Register</button>
  44.             </div>
  45.         )
  46.     }
  47. }
  48.  
  49. export default RegisterLogin;
  50.      
  51. ./src/Register.js
  52.   Line 7:  Parsing error: Unexpected token, expected ";"
  53.  
  54.    5 | firebase.initializeApp(Config)
  55.    6 |
  56.  > 7 | Class RegisterLogin extends Component{
  57.      |       ^
  58.    8 |     constructor(props) {
  59.    9 |         super(props);
  60.   10 |         this.login = this.login.bind(this);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top