auth-js

0.0.16 • Public • Published

auth-js

Auth JS Client for e-city

Installation

Using yarn

yarn add auth-js

Using npm

npm i --save auth-js

Usage

Config

const baseURL = 'http://isse.paliari.com.br/app/rest'
const Auth = {
  install (Vue, {baseURL}) {
    const auth = AuthJs({appModule: 'nfse', baseURL, statusBar: 'darken'})
    Vue.prototype.$auth = auth
    Vue.auth = auth
  }
}
Vue.use(Auth, {baseURL})

Methods

All methods return the Promise instance.

Sign In

 
this.$auth.signIn().then( response => {
  // the response contains token and usuario e.g: {token: {...}, usuario: {...}}
  console.log('success', response)
})
.catch( e => {
  console.log('error', e)
})
 

Sign Out

Sign out current session of user.

 
this.$auth.signOut().then( response => {
  console.log('success', response)
})
.catch( e => {
  console.log('error', e)
})
 

Update passowrd

Update current passowrd of user.

 
this.$auth.updatePassword().then( response => {
  console.log('success', response)
})
.catch( e => {
  console.log('error', e)
})
 

Account

Update account of user.

 
this.$auth.account().then( response => {
  console.log('success', response)
})
.catch( e => {
  console.log('error', e)
})
 

Image

Change image of perfil the user.

 
this.$auth.image().then( response => {
  console.log('success', response)
})
.catch( e => {
  console.log('error', e)
})
 

Address

Update address of user.

 
this.$auth.address().then( response => {
  console.log('success', response)
})
.catch( e => {
  console.log('error', e)
})
 

Modules

Insert/Remove modules of user.

 
this.$auth.modules().then( response => {
  console.log('success', response)
})
.catch( e => {
  console.log('error', e)
})
 

Current

Get current user.

 
this.$auth.current().then( response => {
  console.log('success', response)
})
.catch( e => {
  console.log('error', e)
})
 

Dependencies

  • Promise (the browser suporte reuquired), see: MDN Promise

License

This project is licensed under MIT License

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.0.1659latest

Version History

VersionDownloads (Last 7 Days)Published
0.0.1659
0.0.143
0.0.131
0.0.121
0.0.112
0.0.102
0.0.91
0.0.80
0.0.71
0.0.61
0.0.50
0.0.40
0.0.32
0.0.21
0.0.10

Package Sidebar

Install

npm i auth-js

Weekly Downloads

74

Version

0.0.16

License

MIT

Unpacked Size

17.8 kB

Total Files

3

Last publish

Collaborators

  • dflourusso
  • felipebohnertpaetzold
  • m.paliari
  • paliari_ci