Skip to content

Commit 69ef740

Browse files
authored
Merge pull request #24429 from abpframework/auto-merge/rel-10-0/4205
Merge branch dev with rel-10.0
2 parents 982c982 + 16eec42 commit 69ef740

File tree

2 files changed

+29
-8
lines changed

2 files changed

+29
-8
lines changed

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

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { registerLocaleData } from '@angular/common';
22
import { inject, Injector } from '@angular/core';
33
import { tap, catchError } from 'rxjs/operators';
4-
import { lastValueFrom, throwError } from 'rxjs';
4+
import { firstValueFrom, lastValueFrom, of, throwError, timeout } from 'rxjs';
55
import { ABP } from '../models/common';
66
import { Environment } from '../models/environment';
77
import { CurrentTenantDto } from '../proxy/volo/abp/asp-net-core/mvc/multi-tenancy/models';
@@ -10,17 +10,19 @@ import { EnvironmentService } from '../services/environment.service';
1010
import { SessionStateService } from '../services/session-state.service';
1111
import { CORE_OPTIONS } from '../tokens/options.token';
1212
import { APP_INIT_ERROR_HANDLERS } from '../tokens/app-config.token';
13+
import { CHECK_AUTHENTICATION_STATE_FN_KEY } from '../tokens/check-authentication-state';
14+
import { APP_STARTED_WITH_SSR } from '../tokens/ssr-state.token';
1315
import { getRemoteEnv } from './environment-utils';
1416
import { parseTenantFromUrl } from './multi-tenancy-utils';
1517
import { AuthService } from '../abstracts';
16-
import { CHECK_AUTHENTICATION_STATE_FN_KEY } from '../tokens/check-authentication-state';
1718
import { noop } from './common-utils';
1819

1920
export async function getInitialData() {
2021
const injector = inject(Injector);
2122
const environmentService = injector.get(EnvironmentService);
2223
const configState = injector.get(ConfigStateService);
2324
const options = injector.get(CORE_OPTIONS) as ABP.Root;
25+
const appStartedWithSSR = injector.get(APP_STARTED_WITH_SSR);
2426

2527
environmentService.setState(options.environment as Environment);
2628
await getRemoteEnv(injector, options.environment);
@@ -49,8 +51,18 @@ export async function getInitialData() {
4951
return throwError(() => error);
5052
}),
5153
);
52-
// TODO: Not working with SSR
53-
// await lastValueFrom(result$);
54+
55+
if (appStartedWithSSR) {
56+
await firstValueFrom(
57+
result$.pipe(
58+
timeout(0),
59+
catchError(() => of(null)),
60+
),
61+
);
62+
} else {
63+
await lastValueFrom(result$);
64+
}
65+
5466
await localeInitializer(injector);
5567
}
5668

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

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
import {
2+
withValidationBluePrint,
3+
provideAbpThemeShared,
4+
provideLogo,
5+
withEnvironmentOptions,
6+
} from '@abp/ng.theme.shared';
17
import { ApplicationConfig } from '@angular/core';
28
import { provideRouter } from '@angular/router';
39
import { provideAnimations } from '@angular/platform-browser/animations';
@@ -6,9 +12,8 @@ import { appRoutes } from './app.routes';
612
import { APP_ROUTE_PROVIDER } from './route.provider';
713
import { provideAbpCore, withOptions } from '@abp/ng.core';
814
import { environment } from '../environments/environment';
9-
import { registerLocale } from '@abp/ng.core/locale';
15+
import { registerLocaleForEsBuild } from '@abp/ng.core/locale';
1016
import { provideAbpOAuth } from '@abp/ng.oauth';
11-
import { provideAbpThemeShared, provideLogo, withEnvironmentOptions} from '@abp/ng.theme.shared';
1217
import { provideSettingManagementConfig } from '@abp/ng.setting-management/config';
1318
import { provideAccountConfig } from '@abp/ng.account/config';
1419
import { provideIdentityConfig } from '@abp/ng.identity/config';
@@ -24,19 +29,23 @@ export const appConfig: ApplicationConfig = {
2429
provideAbpCore(
2530
withOptions({
2631
environment,
27-
registerLocaleFn: registerLocale(),
32+
registerLocaleFn: registerLocaleForEsBuild(),
2833
})
2934
),
3035
provideThemeLeptonX(),
3136
provideSideMenuLayout(),
3237
provideAbpOAuth(),
33-
provideAbpThemeShared(),
3438
provideSettingManagementConfig(),
3539
provideAccountConfig(),
3640
provideIdentityConfig(),
3741
provideTenantManagementConfig(),
3842
provideFeatureManagementConfig(),
3943
provideAnimations(),
4044
provideLogo(withEnvironmentOptions(environment)),
45+
provideAbpThemeShared(
46+
withValidationBluePrint({
47+
wrongPassword: 'Please choose 1q2w3E*',
48+
})
49+
),
4150
],
4251
};

0 commit comments

Comments
 (0)