-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
131843d
commit 18cea67
Showing
5 changed files
with
89 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import React, { Component, useContext, useEffect, useState } from "react"; | ||
import FacebookLogin from "react-facebook-login"; | ||
import { ExperienceContext } from "../../contexts/ExperienceContext"; | ||
|
||
export default function Facebook({ handleStatusLogged }) { | ||
const { handleIsLogged } = useContext(ExperienceContext); | ||
const changeStatus = () => { | ||
handleStatusLogged(1); | ||
}; | ||
|
||
const [state, setState] = useState({ | ||
isLoggedIn: false, | ||
userID: "", | ||
name: "", | ||
email: "", | ||
picture: "", | ||
}); | ||
|
||
useEffect(() => {}, []); | ||
|
||
const responseFacebook = (response) => { | ||
console.log(response); | ||
setState({ | ||
// isLoggedIn: true, | ||
userID: response.userID, | ||
name: response.name, | ||
email: response.email, | ||
picture: response.picture.data.url, | ||
}); | ||
handleIsLogged(); | ||
changeStatus(); | ||
}; | ||
|
||
const componentClicked = () => console.log("clicked"); | ||
|
||
const FbContent = ( | ||
<div | ||
style={{ | ||
width: "400px", | ||
margin: "auto", | ||
background: "#f4f4f4", | ||
padding: "20px", | ||
}} | ||
> | ||
<img src={state.picture} alt={state.name} /> | ||
<h2>Welcome {state.name}</h2> | ||
Email: {state.email} | ||
</div> | ||
); | ||
|
||
return ( | ||
<> | ||
{/* {state.isLoggedIn ? ( | ||
<FbContent /> | ||
) : ( | ||
<FacebookLogin | ||
appId="632902014369254" | ||
//autoLoad={true} | ||
fields="name,email,picture" | ||
onClick={componentClicked} | ||
callback={responseFacebook} | ||
/> | ||
)} */} | ||
<FacebookLogin | ||
appId="632902014369254" | ||
// autoLoad={true} | ||
fields="name,email,picture" | ||
onClick={componentClicked} | ||
callback={responseFacebook} | ||
/> | ||
</> | ||
); | ||
} |
This file contains 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
18cea67
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: