-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.config.ts
More file actions
72 lines (67 loc) · 2.44 KB
/
app.config.ts
File metadata and controls
72 lines (67 loc) · 2.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import {
provideFileRouter,
requestContextInterceptor,
withDebugRoutes,
} from '@analogjs/router';
import {
provideHttpClient,
withFetch,
withInterceptors,
} from '@angular/common/http';
import {
ApplicationConfig,
DestroyRef,
importProvidersFrom,
inject,
provideAppInitializer,
provideBrowserGlobalErrorListeners,
provideZoneChangeDetection,
} from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import {
provideClientHydration,
withEventReplay,
} from '@angular/platform-browser';
import { provideNoopAnimations } from '@angular/platform-browser/animations';
import { withComponentInputBinding } from '@angular/router';
import { withFormlyBootstrap } from '@ngx-formly/bootstrap';
import { provideFormlyCore } from '@ngx-formly/core';
import { icons, LucideAngularModule } from 'lucide-angular';
import { provideToastr } from 'ngx-toastr';
import { firstValueFrom } from 'rxjs';
import { AuthService } from './services/auth.service';
import { SessionService } from './services/session.service';
import { TelegramService } from './services/telegram.service';
import { ThemeService } from './services/theme.service';
import { provideTrpcClient } from './trpc-client';
import { provideTrpcPureClient } from './trpc-pure-client';
export const appConfig: ApplicationConfig = {
providers: [
provideFormlyCore(...withFormlyBootstrap()),
provideBrowserGlobalErrorListeners(),
provideZoneChangeDetection({ eventCoalescing: true }),
provideFileRouter(withComponentInputBinding(), withDebugRoutes()),
provideHttpClient(
withFetch(),
withInterceptors([requestContextInterceptor])
),
provideClientHydration(withEventReplay()),
provideTrpcClient(),
provideTrpcPureClient(),
provideNoopAnimations(),
provideToastr(),
importProvidersFrom(LucideAngularModule.pick(icons)),
provideAppInitializer(async () => {
const destroyRef = inject(DestroyRef);
const sessionService = inject(SessionService);
const authService = inject(AuthService);
const telegramService = inject(TelegramService);
const themeService = inject(ThemeService);
sessionService.stream$.pipe(takeUntilDestroyed(destroyRef)).subscribe();
themeService.stream$.pipe(takeUntilDestroyed(destroyRef)).subscribe();
await themeService.init();
await firstValueFrom(telegramService.getSettings());
await firstValueFrom(authService.profile());
}),
],
};