@yca/auth-local
Installation
- Install the dependencies
install @yca/auth
- Install the Ionic plugin
npm i -S @yca/auth-local
- Add it to your app’s NgModule.
// Import your library
import { AuthLocalModule } from '@yca/auth-local';
@NgModule({
...
imports: [
...
// Specify your library as an import
AuthLocalModule.forRoot()
// or user custom paths
AuthLocalModule.forRoot({
root: 'http://xxx.xxx',
signin: '/signin',
signup: '/signup',
reset: '/reset'
})
],
...
})
export class AppModule { }
Usage
Once your library is imported, you can use its service in your Angular application:
import { AuthLocal } from '@yca/auth-local';
constructor(public al: AuthLocal) {
al.signin({
username: 'xxx',
password: 'xxx',
...
});
}
Methods
signin(params: any): Promise<void>;
signup(params: any): Promise<void>;
reset(params: any): Promise<void>;
Interfaces and Types
export interface AuthLocalPaths {
root?: string;
signin?: string;
signup?: string;
reset?: string;
}
export const DefaultAuthLocalPaths: AuthLocalPaths = {
root: 'http://localhost:9000',
signin: '/auth/local',
signup: '/auth/local/signup',
reset: '/auth/local/reset'
}
Development
To generate all *.js
, *.d.ts
and *.metadata.json
files:
$ npm run build
License
MIT © Yu Chen