Skip to content
Permalink
Browse files

Fixed Facebook shit

  • Loading branch information...
keanuk
keanuk committed Apr 2, 2018
1 parent 48716a1 commit 755388fa65096a6cd6d21047cfc64e4d06149172
Showing with 50 additions and 46 deletions.
  1. +50 −46 modules/core/client/controllers/home.client.controller.js
@@ -14,49 +14,53 @@
}());

// Facebook API calls have been disabled temporarily
//
// window.fbAsyncInit = function() {
// FB.init({
// appId : '291380158062880',
// cookie : true,
// xfbml : true,
// version : 'v2.12'
// });
//
// // FB.AppEvents.logPageView();
//
// FB.getLoginStatus(function(response) {
// statusChangeCallback(response);
// });
//
// };
//
// (function(d, s, id){
// var js, fjs = d.getElementsByTagName(s)[0];
// if (d.getElementById(id)) {return;}
// js = d.createElement(s); js.id = id;
// js.src = "https://connect.facebook.net/en_US/sdk.js";
// fjs.parentNode.insertBefore(js, fjs);
// }(document, 'script', 'facebook-jssdk'));
//
// function statusChangeCallback(response) {
// if(response.status === 'connected') {
// console.log('Logged in and authenticated');
// console.log(response.authResponse.accessToken);
// fbCall();
// }
// else {
// console.log('Not authenticated');
// }
// }
//
// function fbCall() {
// FB.api('/cocacola?fields=name,email,events', function(response) {
// if(response && !response.error) {
// console.log(response);
// }
// else {
// console.log(response.error);
// }
// })
// }

let at = 'EAACEdEose0cBAIaOorkydG0LgWJ5g5aUypJpsNEp4NAYOGuN9JowRObGZAc0QTZCJH0ixTzaRrD4mPT8BzZBJflrdkl2MNrZAiviIpFigBlL59KPt4tbfd1c5TlyfeXFZB4fyKSSTyvtjGX0579TqLzoYZBdUXct246ZAw4imS1vjLcl5m0zbjS9YZArZBV2pGdBhLZCchxCjNsy83zqeXn7it';

window.fbAsyncInit = function() {
FB.init({
appId : '291380158062880',
cookie : true,
xfbml : true,
version : 'v2.12'
});

// FB.AppEvents.logPageView();

FB.getLoginStatus(function(response) {
statusChangeCallback(response);
});

};

(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "https://connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));

function statusChangeCallback(response) {
if(response.status === 'connected') {
console.log('Logged in and authenticated');
console.log(response);
// at = response.authResponse.accessToken;
fbCall();
}
else {
console.log('Not authenticated');
}
}

function fbCall() {
console.log(at);
FB.api('/' + 'alachuahumane.org?fields=name,events' + '&access_token=' + at, function(response) {
if(response && !response.error) {
console.log(response);
}
else {
console.log(response.error);
}
})
}

0 comments on commit 755388f

Please sign in to comment.
You can’t perform that action at this time.