Project

General

Profile

« Previous | Next » 

Revision 59816

[Library|Trunk]

code clean up:
-remove app.* files from library
-remove unused imports, code, files (Old search pages for results, dataproviders, map search page, etc)
-remove Freeguard from modules
-unsubscribe all subscriptions
-Services: configuration, isvocabularies, user management: unsubscribe from app component or the component that uses them (clearSubscriptions())
-Fetchers: unsubscribe from the component that uses them (clearSubscriptions())

View differences:

connectRIGuard.guard.ts
1

  
2
import {filter, mergeMap} from 'rxjs/operators';
1
import {tap} from 'rxjs/operators';
3 2
import { Injectable } from '@angular/core';
4 3
import {
5 4
  Router,
......
25 24
  }
26 25

  
27 26
  check(community: string): Observable<boolean> | boolean {
28
    const obs = this.communityService.isRITypeByState(properties, properties['communityAPI'] + community);
29

  
30
    this.sub = obs.pipe(filter(enabled => !enabled))
31
        .subscribe(() => this.router.navigate(['errorcommunity']));
32
    return obs;
27
    return this.communityService.isRITypeByState(properties, properties['communityAPI'] + community).pipe(tap(authorized => {
28
      if (!authorized) {
29
        this.router.navigate(['errorcommunity']);
30
      }
31
    }));
33 32
  }
34

  
35 33
  canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
36 34
    return this.check(route.queryParams['communityId']);
37 35
  }

Also available in: Unified diff