@@ -6,7 +6,6 @@ import { DspApiConnectionToken, Session, SessionService } from '@dasch-swiss/dsp
66import { AppGlobal } from '../app-global' ;
77import { CacheService } from '../main/cache/cache.service' ;
88import { MenuItem } from '../main/declarations/menu-item' ;
9- import { ErrorHandlerService } from '../main/error/error-handler.service' ;
109
1110@Component ( {
1211 selector : 'app-project' ,
@@ -40,7 +39,6 @@ export class ProjectComponent implements OnInit {
4039
4140 constructor (
4241 @Inject ( DspApiConnectionToken ) private _dspApiConnection : KnoraApiConnection ,
43- private _errorHandler : ErrorHandlerService ,
4442 private _session : SessionService ,
4543 private _cache : CacheService ,
4644 private _route : ActivatedRoute ,
@@ -63,20 +61,14 @@ export class ProjectComponent implements OnInit {
6361
6462 if ( ! this . error ) {
6563 this . loading = true ;
66- // set the cache here:
67- // current project data, project members and project groups
68- this . _cache . get ( this . projectcode , this . _dspApiConnection . admin . projectsEndpoint . getProjectByShortcode ( this . projectcode ) ) ;
69-
70- // get information about the logged-in user, if one is logged-in
71- if ( this . session ) {
72-
73- }
74-
75- // get the project data from cache
76- this . _cache . get ( this . projectcode , this . _dspApiConnection . admin . projectsEndpoint . getProjectByShortcode ( this . projectcode ) ) . subscribe (
64+ // get current project data, project members and project groups
65+ // and set the project cache here
66+ this . _dspApiConnection . admin . projectsEndpoint . getProjectByShortcode ( this . projectcode ) . subscribe (
7767 ( response : ApiResponseData < ProjectResponse > ) => {
7868 this . project = response . body . project ;
7969
70+ this . _cache . set ( this . projectcode , this . project ) ;
71+
8072 if ( ! this . project . status ) {
8173 this . color = 'warn' ;
8274 }
@@ -101,17 +93,15 @@ export class ProjectComponent implements OnInit {
10193 this . _cache . get ( 'groups_of_' + this . projectcode , this . _dspApiConnection . admin . groupsEndpoint . getGroups ( ) ) ;
10294 }
10395
104- this . loading = false ;
96+ if ( this . _cache . has ( this . projectcode ) ) {
97+ this . loading = false ;
98+ }
10599 } ,
106100 ( error : ApiResponseError ) => {
107- this . _errorHandler . showMessage ( error ) ;
108101 this . error = true ;
109102 this . loading = false ;
110103 }
111104 ) ;
112- } else {
113- // shortcode isn't valid
114- // --> TODO show an error page
115105 }
116106 }
117107
0 commit comments