e1-service
    TypeScript icon, indicating that this package has built-in type declarations

    3.0.1 • Public • Published

    Notes

    • Version 3.0.1 is compatible with Angular 9
    • Version 3.0.0 is compatible with Angular 6
    • From Version 3.0.0, enter full Url to the API. This change is to cater for AIS version 2 API. For API version 1, append /jderest/ and /jderest/v2/ for version 2.

    e1-service

    E1 Service Library.

    Installation

    Install the Redux Store and DevTools, run:

    $ npm install @ngrx/store --save
    $ npm install @ngrx/store-devtools --save-dev

    Then install e1-service, run:

    $ npm install e1-service --save

    E1 Starter

    For a starter E1 project, clone e1-ng-start:

    $ git clone https://github.com/Herdubreid/e1-ng-start.git <your project folder>

    Consuming the e1-services

    In your Angular AppModule, add the modules and services:

    import { BrowserModule } from '@angular/platform-browser';
    import { NgModule } from '@angular/core';
     
    import { AppComponent } from './app.component';
     
    // Import the Store
    import { StoreModule } from '@ngrx/store';
    // Import the DevTools
    import { StoreDevtoolsModule } from '@ngrx/store-devtools';
     
    // Import e1-services
    import { E1ServiceModule, e1Reducer } from 'e1-service';
     
    @NgModule({
      declarations: [
        AppComponent
      ],
      imports: [
        BrowserModule,
        E1ServiceModule,
        StoreModule.forRoot({ e1: e1Reducer }),
        !environment.production ? StoreDevtoolsModule.instrument() : []
      ],
      providers: [
      ],
      bootstrap: [AppComponent]
    })
    export class AppModule { }

    Once e1-service is imported, you can inject it in your Angular components:

    ...
    import { SignonService } from 'e1-service';
     
    export class AppComponent {
      ...
      constructor(
        signon: SignonService
      ) {
        // Test url
        signon.testUrl('https://server:port/jderest/',
        {
          success: () => {
            // Valid Url
            console.log('success!');
            // Set credentials
            signon.username = 'username';
            signon.password = 'password';
            // Authenticate
            signon.authenticate(
              {
                success: () => console.log('Signed on!'),
                error: (msg) => console.log('Signon error:', msg);
              }
          },
          error: (msg) => {
            console.log('Invalid Url:', error);
          });
        }
      }
    }
     

    License

    MIT © Finnur Bragason

    e1-services

    Install

    npm i e1-service

    DownloadsWeekly Downloads

    2

    Version

    3.0.1

    License

    MIT

    Unpacked Size

    93.3 kB

    Total Files

    56

    Last publish

    Collaborators

    • avatar