### File

`projects/app-base-library/src/lib/angular/modules/drupal/drupal.resolve.ts`

### Index

###### Properties

- Public config

###### Methods

- resolve

### Constructor

`constructor(baseService: BaseService, config: ConfigService, drupal: DrupalService)`
Defined in projects/app-base-library/src/lib/angular/modules/drupal/drupal.resolve.ts:8

Parameters :

Name | Type | Optional
baseService | `BaseService` | no
config | `ConfigService` | no
drupal | `DrupalService` | no

### Methods

resolve
`resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot)`
Defined in projects/app-base-library/src/lib/angular/modules/drupal/drupal.resolve.ts:12

Parameters :

Name | Type | Optional
route | `ActivatedRouteSnapshot` | no
state | `RouterStateSnapshot` | no

Returns : `any`

### Properties

Public config
`config: `ConfigService``
Type : `ConfigService`
Defined in projects/app-base-library/src/lib/angular/modules/drupal/drupal.resolve.ts:10

    import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
    import { Injectable } from '@angular/core';
    import { BaseService } from '../../services/base.service';
    import { ConfigService } from '../../services/config.service';
    import { DrupalService } from './drupal.service';

    @Injectable()
    export class DrupalResolve implements Resolve<any> {

        constructor(private baseService: BaseService, public config: ConfigService, private drupal: DrupalService) { }

        resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
            return new Promise(resolve => {
                this.config.set('loading',true);
                // dev
                if (this.baseService.settings['dev'] && this.baseService.settings['drupal-dev']) {
                    for (const k in this.baseService.settings['drupal-dev']) {
                        this.baseService.settings['drupal'][k] = this.baseService.settings['drupal-dev'][k];
                    }
                }
                // production
                this.drupal.init(this.baseService.settings['drupal']).then(() => {

                    if(this.config.get('drupal').app_uuid) {
                        this.drupal.getAppNode(this.config.get('drupal').app_uuid).then(() => {
                            console.log('drupal.getAppNode: resolved');
                            this.config.set('loading',false);
                            resolve(this.drupal);
                        });
                    } else {
                        this.config.set('loading',false);
                        resolve(this.drupal);
                    }

                });
            });
        }
    }

# results matching ""

# No results matching ""