Browse Source

Merge pull request #24429 from abpframework/auto-merge/rel-10-0/4205

Merge branch dev with rel-10.0
pull/22962/merge
Ma Liming 2 days ago
committed by GitHub
parent
commit
69ef740552
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 20
      npm/ng-packs/packages/core/src/lib/utils/initial-utils.ts
  2. 17
      templates/app/angular/src/app/app.config.ts

20
npm/ng-packs/packages/core/src/lib/utils/initial-utils.ts

@ -1,7 +1,7 @@
import { registerLocaleData } from '@angular/common';
import { inject, Injector } from '@angular/core';
import { tap, catchError } from 'rxjs/operators';
import { lastValueFrom, throwError } from 'rxjs';
import { firstValueFrom, lastValueFrom, of, throwError, timeout } from 'rxjs';
import { ABP } from '../models/common';
import { Environment } from '../models/environment';
import { CurrentTenantDto } from '../proxy/volo/abp/asp-net-core/mvc/multi-tenancy/models';
@ -10,10 +10,11 @@ import { EnvironmentService } from '../services/environment.service';
import { SessionStateService } from '../services/session-state.service';
import { CORE_OPTIONS } from '../tokens/options.token';
import { APP_INIT_ERROR_HANDLERS } from '../tokens/app-config.token';
import { CHECK_AUTHENTICATION_STATE_FN_KEY } from '../tokens/check-authentication-state';
import { APP_STARTED_WITH_SSR } from '../tokens/ssr-state.token';
import { getRemoteEnv } from './environment-utils';
import { parseTenantFromUrl } from './multi-tenancy-utils';
import { AuthService } from '../abstracts';
import { CHECK_AUTHENTICATION_STATE_FN_KEY } from '../tokens/check-authentication-state';
import { noop } from './common-utils';
export async function getInitialData() {
@ -21,6 +22,7 @@ export async function getInitialData() {
const environmentService = injector.get(EnvironmentService);
const configState = injector.get(ConfigStateService);
const options = injector.get(CORE_OPTIONS) as ABP.Root;
const appStartedWithSSR = injector.get(APP_STARTED_WITH_SSR);
environmentService.setState(options.environment as Environment);
await getRemoteEnv(injector, options.environment);
@ -49,8 +51,18 @@ export async function getInitialData() {
return throwError(() => error);
}),
);
// TODO: Not working with SSR
// await lastValueFrom(result$);
if (appStartedWithSSR) {
await firstValueFrom(
result$.pipe(
timeout(0),
catchError(() => of(null)),
),
);
} else {
await lastValueFrom(result$);
}
await localeInitializer(injector);
}

17
templates/app/angular/src/app/app.config.ts

@ -1,3 +1,9 @@
import {
withValidationBluePrint,
provideAbpThemeShared,
provideLogo,
withEnvironmentOptions,
} from '@abp/ng.theme.shared';
import { ApplicationConfig } from '@angular/core';
import { provideRouter } from '@angular/router';
import { provideAnimations } from '@angular/platform-browser/animations';
@ -6,9 +12,8 @@ import { appRoutes } from './app.routes';
import { APP_ROUTE_PROVIDER } from './route.provider';
import { provideAbpCore, withOptions } from '@abp/ng.core';
import { environment } from '../environments/environment';
import { registerLocale } from '@abp/ng.core/locale';
import { registerLocaleForEsBuild } from '@abp/ng.core/locale';
import { provideAbpOAuth } from '@abp/ng.oauth';
import { provideAbpThemeShared, provideLogo, withEnvironmentOptions} from '@abp/ng.theme.shared';
import { provideSettingManagementConfig } from '@abp/ng.setting-management/config';
import { provideAccountConfig } from '@abp/ng.account/config';
import { provideIdentityConfig } from '@abp/ng.identity/config';
@ -24,13 +29,12 @@ export const appConfig: ApplicationConfig = {
provideAbpCore(
withOptions({
environment,
registerLocaleFn: registerLocale(),
registerLocaleFn: registerLocaleForEsBuild(),
})
),
provideThemeLeptonX(),
provideSideMenuLayout(),
provideAbpOAuth(),
provideAbpThemeShared(),
provideSettingManagementConfig(),
provideAccountConfig(),
provideIdentityConfig(),
@ -38,5 +42,10 @@ export const appConfig: ApplicationConfig = {
provideFeatureManagementConfig(),
provideAnimations(),
provideLogo(withEnvironmentOptions(environment)),
provideAbpThemeShared(
withValidationBluePrint({
wrongPassword: 'Please choose 1q2w3E*',
})
),
],
};

Loading…
Cancel
Save