### File

`projects/app-base-library/src/lib/angular/services/base.service.ts`

### Index

###### Properties

- Public config
- Public credentials
- Public isOnline
- Public restoreLocalModel
- Public saveLocalModel
- Public settings

###### Methods

- Public Async fetchCredentials

### Constructor

`constructor(config: ConfigService)`
Defined in projects/app-base-library/src/lib/angular/services/base.service.ts:13

Parameters :

Name | Type | Optional
config | `ConfigService` | no

### Methods

Public Async fetchCredentials
`fetchCredentials(url: )`
Defined in projects/app-base-library/src/lib/angular/services/base.service.ts:19

Parameters :

Name | Optional
url | no

Returns : `{}`

### Properties

Public config
`config: `ConfigService``
Type : `ConfigService`
Defined in projects/app-base-library/src/lib/angular/services/base.service.ts:15

Public credentials
`credentials: `any``
Type : `any`
Default value : `{}`
Defined in projects/app-base-library/src/lib/angular/services/base.service.ts:10

Public isOnline
`isOnline: ```
Default value : `Util.isOnline`
Defined in projects/app-base-library/src/lib/angular/services/base.service.ts:13

Public restoreLocalModel
`restoreLocalModel: ```
Default value : `Storage.restoreLocalModel`
Defined in projects/app-base-library/src/lib/angular/services/base.service.ts:12

Public saveLocalModel
`saveLocalModel: ```
Default value : `Storage.saveLocalModel`
Defined in projects/app-base-library/src/lib/angular/services/base.service.ts:11

Public settings
`settings: `any``
Type : `any`
Defined in projects/app-base-library/src/lib/angular/services/base.service.ts:9

    import { Injectable } from '@angular/core';
    import { Storage, Util } from './../../shared/index';
    import { ConfigService } from './config.service';
    declare var Promise: any;

    @Injectable()
    export class BaseService {

        public settings: any;
        public credentials: any = {};
        public saveLocalModel = Storage.saveLocalModel;
        public restoreLocalModel = Storage.restoreLocalModel;
        public isOnline = Util.isOnline;

        constructor(public config: ConfigService  ) {
            this.settings = this.config['_config'];
        }

        public async fetchCredentials(url) {
            const self = this;
            let result =  await fetch(url)
                .then(function(response) {
                    return response.json();
                })
                .catch(function(error) {
                    console.log('credentials fetch error:', error.message);
                });
            Object.keys(result.credentials).forEach(function (key) {
                self.credentials[key] = result.credentials[key];
            });
            return self.credentials;
        }

    }

# results matching ""

# No results matching ""