@kailight/socials
v0.0.8
Published
Vue socials interaction - client side
Downloads
3
Readme
Documentation
import Socials from '@kailight/socials'
let options = {
// tribefire-auth server to point popup to
base : 'http://localhost:3000',
// dispatch this vuex action when login happens
onLogin : 'onSocialLogin',
// this route is automatically added to router and is used for callback
cb : '/auth-callback'
// since we use client-side auth, Facebook clientId is required
Facebook : { clientId : 'some numbers' }
}
Vue.use( Socials, options )
// In your store add mutation
onSocialLogin: (context, data) => {
info('setUserData()', data)
context.commit('setUserData', data)
}
// that will call following action
onSocialLogin: (state, data) => {
info('setUserData', data)
if (data.social) {
state.User[data.social] = data.data
}
}
}
Then, in your component
this.$Socials.login('Twitter')
Note that this code only works in conjuction with backend, property of Tribefire
See github