I have an Angular 4 app using ngrx. The current principal is part of the store. Whenever the principal changes (usually login or logout, but there might later be some sort of "switch user" functionality), I'd like to update the look&feel of the application. I already have code which will add a global CSS style, as well as replace a logo.
The part I'm unsure about: should this be implemented as ngrx effect, as a service, or something else?
store.select( 'principal' ).subscribe(( state ) => {
this.updateCorporateIdentity( state );
} );
I currently have this in a CorporateIdentityService, but I'm not happy about the fact that I need to inject the service somewhere to get it created. Injecting it in app.component results in a lint error
Property 'corporateIdentityService' is declared but never used.
which I believe is justified. Another programmer will stumble upon that unused service and remove it. Ngrx effects, afaik, react to an action and produce a new action. My code won't produce a new action.
What's "the Angular way" to implement this?
Thanks