-
-
Save readysetawesome/2288256 to your computer and use it in GitHub Desktop.
Invocation of Livefyre commenting and Livefyre Simple Profiles (bolt-on for existing init)
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
var engage = new fyre.sp.app.Engage({app: '{!! name of your engage app here !!}'); | |
var profiles = new fyre.sp.app.Profile({}); | |
var delegates = { | |
'handle_auth_login': function() { | |
engage.signIn(); | |
}, | |
'handle_auth_logout': function() { | |
engage.signOut(); | |
}, | |
'handle_edit_profile': function(user) { | |
profiles.editProfile(); | |
}, | |
'handle_view_profile': function(user) { | |
var id = user.jid.split('@')[0]; | |
profiles.viewProfile(id); | |
}, | |
'handle_email_notifications': function(user) { | |
} | |
}; | |
fyre.sp.on('auth_logout_complete', function() { | |
LF.modules.Auth.logoutSuccess(); | |
}); | |
fyre.sp.on('profile_submit_complete', function(data) { | |
LF.Fyre.get('user').set({display_name: data.displayName}); | |
}); | |
fyre.sp.on('auth_login_complete', function(data) { | |
LF.ready(function() { | |
LF.login({ | |
token: (data.token || data.accessCredentials[0].value), | |
profile: {display_name: data.displayName} | |
}) | |
} | |
); | |
}); | |
LF.ready(function() { | |
LF.Dispatcher.addListener(delegates); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment