1.0.24 • Published 6 years ago

authmodule-angular6-module-example v1.0.24

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

CONFIGURATION

########## Import in app.module.ts

import { AuthenticationModule } from 'authmodule-angular6-module-example';

@NgModule({
    ...
    imports: [
        AuthenticationModule.forRoot({
            apiUrl: 'http://localhost:3000', # API Url
            loginEndpoint: 'users'  # [users or admin] endPoint in Loopback (for http://localhost:3000/users/login),
            createAccount: 'register', # route for register page *optional
            loginAccount: 'login' #route for login page *optional
        })
    ]
    ...
})

########## To use in a component:

import { AuthenticationService } from 'authmodule-angular6-module-example';
...
constructor(private authenticationService: AuthenticationService) {
    console.log('from authenticationService', this.authenticationService.isAuthenticated());
}

########## Exposed Methods

isAuthenticated() : Returns a boolean with the isLoggedIn value.

login(values: CredentialsInterface): Receive a credentials interface (email: string and password: string) and 
    if is a login success set the token and isLoggedIn in localstorage and variable isLoggedIn as true.

logout(): void: Remove token and isLoggedIn from localStorage and the variable isLoggedIn set to false.

########## Component Selectors

auth-app-login

        @Output()
        submit: EventEmitter<any> = new EventEmitter();

auth-app-register

        @Output()
        submit: EventEmitter<any> = new EventEmitter();

auth-app-change-password

        @Output()
        submit: EventEmitter<any> = new EventEmitter();
1.0.24

6 years ago

1.0.23

6 years ago

1.0.22

6 years ago

1.0.21

6 years ago

1.0.20

6 years ago

1.0.19

6 years ago

1.0.18

6 years ago

1.0.17

6 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago