barsa-novin-ray-core 2.0.116 → 2.0.117

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3676,6 +3676,23 @@ class PortalService {
3676
3676
  this.loadSystem();
3677
3677
  this.dateTextSource.next(BarsaApi.LoginFormData.DateText);
3678
3678
  }
3679
+ _getDefaultPage(c) {
3680
+ if (!c || !c.length) {
3681
+ return null;
3682
+ }
3683
+ let x = c.find((c) => c.IsDefaultRoute === 'True');
3684
+ if (x) {
3685
+ return x;
3686
+ }
3687
+ let x2 = null;
3688
+ c.forEach((element) => {
3689
+ if (x2) {
3690
+ return;
3691
+ }
3692
+ x2 = this._getDefaultPage(element.ChildPageList?.MoDataList);
3693
+ });
3694
+ return x2;
3695
+ }
3679
3696
  loadPortalDataSync() {
3680
3697
  if (BarsaApi.LoginFormData?.error?.userMessage) {
3681
3698
  return;
@@ -3684,7 +3701,8 @@ class PortalService {
3684
3701
  const portalSetting = BarsaApi.Ext.decode(portalSettingStr);
3685
3702
  const portalData = portalSetting;
3686
3703
  if (portalData) {
3687
- const defaultPage = portalData.ChildPageList.MoDataList.find((c) => c.IsDefaultRoute === 'True');
3704
+ const defaultPage = this._getDefaultPage(portalData.ChildPageList.MoDataList);
3705
+ this.DefaultPage = defaultPage;
3688
3706
  let configRoute = this._router.config;
3689
3707
  const removePaged = [];
3690
3708
  configRoute.forEach((c, index) => {
@@ -3695,7 +3713,7 @@ class PortalService {
3695
3713
  });
3696
3714
  const pathToRemove = removePaged.map((d) => d.path);
3697
3715
  configRoute = configRoute.filter((c) => pathToRemove.indexOf(c.path) === -1);
3698
- if (defaultPage) {
3716
+ if (defaultPage != null) {
3699
3717
  const defaultPageRoute = defaultPage.Route.replace('/', '');
3700
3718
  const defaultPath = configRoute.find((c) => c.path === '');
3701
3719
  defaultPath && (defaultPath.redirectTo = defaultPageRoute);
@@ -13563,7 +13581,8 @@ class RedirectHomeGuard {
13563
13581
  this._handle(route.queryParams);
13564
13582
  return of(!BarsaApi.LoginFormData.IsAnonymous && BarsaApi.LoginFormData.IsUserLoggedIn).pipe(withLatestFrom(this._portalService.portalData$), tap(([hasAuthorized, portalData]) => {
13565
13583
  if (hasAuthorized) {
13566
- const homePage = portalData?.ChildPageList.MoDataList.find((c) => c.IsDefaultRoute === 'True');
13584
+ const homePage = this._portalService.DefaultPage ||
13585
+ portalData?.ChildPageList.MoDataList.find((c) => c.IsDefaultRoute === 'True');
13567
13586
  const homeRoute = homePage?.Route || 'home';
13568
13587
  this.router.navigate([homeRoute]);
13569
13588
  }