- ABP Framework version: v7.4.x
- UI Type: Angular
- Database System: EF Core (SQL Server)
I have created my own custom configuration service and added it to the app.module as a provider:
{
provide: APP_INITIALIZER,
useFactory: configurationFactory,
deps: [ConfigurationService, ConfigStateService],
multi: true,
},
There are configuration properties that I need before authentication and after authentication, how can I call my configuration service after the user has authenticated to refresh the configuration properties?
I see this being done already by the abp framework, how can I achieve the same?
Thanks.
3 Answer(s)
-
0
Hello,
I am not exactly sure but I think this might help you.
try to call your method inside below code in
app.component.ts
export class AppComponent { constructor(private authService:AuthService) { } ngOnInit(): void { if(this.authService.isAuthenticated){ console.log('logged in'); //you can call your method here for refreshing the configuration properties } } }
thanks
-
0
Yeah, that's what I have, not sure if there was another way. Do you know how it is handled by the framework, is there any source code I can reference?
-
0
Hi,
Maybe you can consider this: https://docs.abp.io/en/abp/latest/UI/Angular/Config-State-Service#set-state
import {AbpApplicationConfigurationService, ConfigStateService} from '@abp/ng.core'; constructor(private abpApplicationConfigurationService: AbpApplicationConfigurationService, private config: ConfigStateService) { this.abpApplicationConfigurationService.get().subscribe(config => { //you can call your method here for refreshing the configuration properties }) }