@kailight/socials

0.0.8 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i @kailight/socials

Weekly Downloads

1

Version

0.0.8

License

MIT

Unpacked Size

34.5 kB

Total Files

13

Last publish

Collaborators

  • kailight