Project

General

Profile

« Previous | Next » 

Revision 55964

[Library|Trunk]

Merge into trunk branch angular7 rev 55729

View differences:

connectRIGuard.guard.ts
1

  
2
import {filter, mergeMap} from 'rxjs/operators';
1 3
import { Injectable } from '@angular/core';
2 4
import {
3 5
  Router,
......
5 7
  ActivatedRouteSnapshot,
6 8
  RouterStateSnapshot,
7 9
  CanLoad,
8
  Route
10
  Route, UrlSegment
9 11
} from '@angular/router';
10
import {Observable} from 'rxjs/Observable';
12
import {Observable} from 'rxjs';
11 13
import {CommunityService} from '../community/community.service';
12 14
import { EnvironmentSpecificService} from '../../utils/properties/environment-specific.service';
13 15
import {ConnectHelper} from '../connectHelper';
......
21 23
  }
22 24

  
23 25
  check(community: string): Observable<boolean> | boolean {
24
    const obs = this.propertiesService.subscribeEnvironment().mergeMap(properties => {
26
    const obs = this.propertiesService.subscribeEnvironment().pipe(mergeMap(properties => {
25 27
      return this.communityService.isRIType(properties, properties['communityAPI'] + community);
26
    });
27
    obs.filter(enabled => !enabled)
28
    }));
29
    obs.pipe(filter(enabled => !enabled))
28 30
        .subscribe(() => this.router.navigate(['errorcommunity']));
29 31
    return obs;
30 32
  }
......
33 35
    return this.check(route.queryParams['communityId']);
34 36
  }
35 37

  
36
  canLoad(route: Route): Observable<boolean> | Promise<boolean> | boolean {
38
  canLoad(route: Route, segments: UrlSegment[]): Observable<boolean> | Promise<boolean> | boolean {
37 39
    const path = '/' + route.path + document.location.search;
38 40
    return this.check(ConnectHelper.getCommunityFromPath(path));
39 41
  }

Also available in: Unified diff