touress-fe-core
v0.1.4
Published
Core functions for frontend, admin and mobile app.
Downloads
4
Readme
Touress Core - Frontend
Core logic for frontend side should be all here (www, admin and mobile app)
Installation
$ npm install --save touress-fe-core
Usage
// import the module
let core = requrire('touress-fe-core');
// for authentication use 'auth' object
let errors = core.auth.validateCredentials('your-username', 'your-password');
if(errors.size() > 0){
// handle errors
}
// success, do something else
API
Authentication -
auth
.login(username, password)
- A function to login usingusername
andpassword
, mostly with end customers.- return : Promise for
success
anderror
.
- return : Promise for
.loginWithCompanyCode(username, password, companyCode)
- A function to login usingusername
,password
andcompanyCode
. It will be used by admin.- return : Promise for
success
anderror
.
- return : Promise for
.validateCredentials(username, password)
- A function to validate whether or not theusername
andpassword
you pass in are valid.- return :
errors
as string[], contain one or more error message.
- return :