1.0.0 • Published 9 years ago

account-client v1.0.0

Weekly downloads
6
License
Apache-2.0
Repository
github
Last release
9 years ago

account-client

An all things client API for the browser

Build Status Coverage Status Dependency Status devDependency Status

account-client is a JavaScript front-end client for the Account REST API. It presists session information in localStorage and provides front-end friendly APIs for things like creating a user account, confirming, resetting a password, changing profile information, or closing the account.

There is also an admin-specific account client

Example

var account = new Account('https://example.com/account/api')

if (account.isSignedIn()) {
  renderWelcome(account)
}

account.on('signout', redirectToHome)

Full API

var account = new Account(options)
account.username
account.isSignedIn()

account.signUp()
account.confirm()
account.signIn()
account.signOut()
account.request()
account.get()
account.fetch()
account.update()
account.validate()

account.on('signup', handler)
account.on('signin', handler)
account.on('signout', handler)
account.on('update', handler)
account.on('reauthenticated', handler)
account.on('error:unauthenticated', handler)
account.one('signin', handleOnce)
account.off('signin', handler)

See more examples, options, etc at http://hoodiehq.github.io/account-client

Testing

In Node.js

Run all tests and validates JavaScript Code Style using standard

npm test

To run only the tests

npm run test:node

Run tests in browser

test:browser:local

This will start a local server. All tests and coverage will be run at http://localhost:8080/__zuul

Contributing

Have a look at the Hoodie project's contribution guidelines. If you want to hang out you can join our Hoodie Community Chat.

License

Appache 2.0