App Configuration

The provided configuration defines the structure for customizing the permisson settings in your application.

We use Permissions Initilizer to get permission when the app initilize.

Your config will be smilier to this example:

app.config
import {APP_INITIALIZER} from '@angular/core';
import {
  LIB_UTILITIES_CONFIG,
  PermissionsInitializer,
} from '@tradinos/cms-frontend-utilities';
import {
  PermissionService,
  PermissionsInitializer,
} from '@tradinos/cms-frontend-permission';

{
    provide: LIB_UTILITIES_CONFIG,
    useValue: {
      SERVER_API_URL: environment.API_URL,
    },
  },
  {
    provide: APP_INITIALIZER,
    useFactory: (
      authService: AuthService,
      permissionService: PermissionService
    ) => {
      if (authService.isLoggedIn)
        return PermissionsInitializer(permissionService);
      return () => undefined;
    },
    deps: [AuthService, PermissionService],
    multi: true,
}

Last updated