diff --git a/src/Routers.jsx b/src/Routers.jsx index 6bb5318..f1c2d41 100644 --- a/src/Routers.jsx +++ b/src/Routers.jsx @@ -47,6 +47,7 @@ import OffersInterestPage from "./views/OffersInterestPage"; import ManageInterestOfferPage from './views/ManageInterestOfferPage' import MyWaitingJobsPage from "./views/MyWaitingJobsPage"; import FamilyMarketPage from "./views/FamilyMarketPage"; +import FacebookRedirect from "./views/FacebookRedirect"; export default function Routers() { return ( @@ -56,6 +57,7 @@ export default function Routers() { } /> } /> } /> + } /> { + if(!codeResponse){ + navigate('/login', {state: {error: true}}) + return + } + console.log(codeResponse); + + setTimeout(()=>{ // remove LATER + navigate('/login', {state: {error: true}}) + },2000) + + /* + POST /token HTTP/1.1 + Host: oauth2.googleapis.com + Content-Type: application/x-www-form-urlencoded + + code=4/P7q7W91a-oMsCeLvIaQm6bTrgtp7& + client_id=your_client_id& + client_secret=your_client_secret& + redirect_uri=https%3A//oauth2.example.com/code& + grant_type=authorization_code + */ + var reqData = { + auth_type: "GOOGLE", + code: codeResponse, + redirect_uri: process.env.REACT_APP_GOOGLE_REDIRECT_URL, + }; + // userApi + // .authStart(reqData) + // .then((res) => { + // if (res.status == 200 && res.data.internal_return >= 0 && res.data.member_id && res.data.uid && res.data.session) { + // localStorage.setItem("member_id", `${res.data.member_id}`); + // localStorage.setItem("uid", `${res.data.uid}`); + // localStorage.setItem("session_token", `${res.data.session}`); + // dispatch(updateUserDetails({...res.data})); + // navigate('/', {replace: true}) + // return + // } + // navigate('/login', {state: {error: true}}) + // }) + // .catch((error) => { + // navigate('/login', {state: {error: true}}) + // console.log(error); + // }); + },[]) + return ( + +
Redirecting ...
+
+ ) +} + +export default FbookRedirect diff --git a/src/components/AuthPages/Login/index.jsx b/src/components/AuthPages/Login/index.jsx index c296aee..4cbd14d 100644 --- a/src/components/AuthPages/Login/index.jsx +++ b/src/components/AuthPages/Login/index.jsx @@ -321,25 +321,32 @@ export default function Login() {
- - + +
- - + +
@@ -427,7 +434,7 @@ export default function Login() { ); } -const BrandBtn = ({ link, imgSrc, brand, onClick }) => { +const BrandBtn = ({ link, imgSrc, brand, onClick, isAnchor=false }) => { // const doGoogle = async () => { // alert("start google"); // }; @@ -446,10 +453,23 @@ const BrandBtn = ({ link, imgSrc, brand, onClick }) => { // const doFacebook = async () => { // alert("start facebook"); // }; - return (
- + ) + }
- ); + ) }; + diff --git a/src/views/FacebookRedirect.jsx b/src/views/FacebookRedirect.jsx new file mode 100644 index 0000000..be26df4 --- /dev/null +++ b/src/views/FacebookRedirect.jsx @@ -0,0 +1,13 @@ +import React from 'react' + +import FbookRedirect from '../components/AuthPages/AuthRedirect/FbookRedirect' + +function FacebookRedirect() { + return ( + <> + + + ) +} + +export default FacebookRedirect \ No newline at end of file