<commit_before>import React, { Component } from 'react';
import {Button} from "react-bootstrap";

class FacebookButton extends Component {
        constructor(props) {
        super(props);

        this.state = {
            connected: "",
            buttonText: ""
        };

        this.handleLogInOut = this.handleLogInOut.bind(this);
        this.checkLoginState = this.checkLoginState.bind(this);
        this.testAPI = this.testAPI.bind(this);
   }


    componentDidMount() {
    window.fbAsyncInit= function() {
        FB.init({
            appId      : '1658650714438155',
            cookie     : true,  // enable cookies to allow the server to access
                            // the session
            fields     : 'id,name,email,picture',
            xfbml      : true,  // parse social plugins on this page
            version    : 'v2.8' // use version 2.1
        });
    }.bind(this);
    this.checkLoginState();

    }

    handleLogInOut() {
        var that = this;
        if(this.state.connected === "notconnected"){
            FB.login(function(response) {
                console.log(response);
                that.checkLoginState();
            });
        }
        else{
            FB.logout(function(response) {
                console.log(response);
                that.checkLoginState();
            });
        }
    }


    testAPI() {
        console.log('Welcome!  Fetching your information.... ');
        FB.api('/me', 'GET', {fields: 'name,id,picture,email'}, function(response) {
            console.log('Successful login for: ' + response.name);
            console.log('Thanks for logging in, ' + response.name + '!');
            console.log(JSON.stringify(response));

        });
    }

    checkLoginState() {
        FB.getLoginStatus(function(response) {
            console.log(response);
            if (response.status === 'connected') {
                this.setState(() => ({
                    connected: "connected",
                    buttonText: "Log out"
                }));
            } else {
                this.setState(() => ({
                    connected: "notconnected",
                    buttonText: "Log in"
                }));
            }
        }.bind(this));
    }


    render(){
        return (
            <div>
                <Button id="" onClick={this.handleLogInOut}>{this.state.buttonText + " with Facebook"}</Button>
                <Button onClick={this.checkLoginState}>Status</Button>
            </div>
        );
    }
}

export default FacebookButton;<commit_msg>removed status button<commit_after>import React, { Component } from 'react';
import {Button} from "react-bootstrap";

class FacebookButton extends Component {
        constructor(props) {
        super(props);

        this.state = {
            connected: "",
            buttonText: ""
        };

        this.handleLogInOut = this.handleLogInOut.bind(this);
        this.checkLoginState = this.checkLoginState.bind(this);
        this.findInfo = this.findInfo.bind(this);
   }


    componentDidMount() {
    window.fbAsyncInit= function() {
        FB.init({
            appId      : '1658650714438155',
            cookie     : true,  // enable cookies to allow the server to access
                            // the session
            fields     : 'id,name,email,picture',
            xfbml      : true,  // parse social plugins on this page
            version    : 'v2.8' // use version 2.1
        });
    }.bind(this);
    this.checkLoginState();

    }

    handleLogInOut() {
        var that = this;
        if(this.state.connected === "notconnected"){
            FB.login(function(response) {
                that.checkLoginState();
            });
        }
        else{
            FB.logout(function(response) {
                that.checkLoginState();
            });
        }
    }


    findInfo() {
        console.log('Fetching your information.... ');
        FB.api('/me', 'GET', {fields: 'name,id,picture,email'}, function(response) {
            console.log('Thanks for logging in:');
            console.log(response.name);
            console.log(response.id);
            console.log(response.email);
            console.log(response.picture.data.url);

        });
    }

    checkLoginState() {
        FB.getLoginStatus(function(response) {
            console.log(response);
            if (response.status === 'connected') {
                this.setState(() => ({
                    connected: "connected",
                    buttonText: "Log out"
                }));
                this.findInfo();
            } else {
                this.setState(() => ({
                    connected: "notconnected",
                    buttonText: "Log in"
                }));
            }
        }.bind(this));
    }


    render(){
        return (
            <div>
                <Button id="" onClick={this.handleLogInOut}>{this.state.buttonText + " with Facebook"}</Button>
            </div>
        );
    }
}

export default FacebookButton;
{'fraction_non_alphanumeric': 0.1308559003755683, 'fraction_numerical': 0.007906700929037358, 'mean_word_length': 1.5, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1850585', 'n_tokens_mistral': 1388, 'n_tokens_neox': 1307, 'n_words': 247}