diff options
author | Chocobozzz <me@florianbigard.com> | 2021-06-04 11:46:17 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-06-04 15:45:44 +0200 |
commit | 8e08d415f9473b6b72fef698729453e726da16e7 (patch) | |
tree | b03d004eb216fb5e410619aa85ddf57539be47f9 /client/src/app/app.module.ts | |
parent | 584ac47a323d6e57233fce4451d43d4943bfaa10 (diff) | |
download | PeerTube-8e08d415f9473b6b72fef698729453e726da16e7.tar.gz PeerTube-8e08d415f9473b6b72fef698729453e726da16e7.tar.zst PeerTube-8e08d415f9473b6b72fef698729453e726da16e7.zip |
Load server config on app init
Diffstat (limited to 'client/src/app/app.module.ts')
-rw-r--r-- | client/src/app/app.module.ts | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts index 9f46d49a2..8fc054d79 100644 --- a/client/src/app/app.module.ts +++ b/client/src/app/app.module.ts | |||
@@ -1,13 +1,13 @@ | |||
1 | import 'focus-visible' | 1 | import 'focus-visible' |
2 | import { environment } from 'src/environments/environment' | 2 | import { environment } from 'src/environments/environment' |
3 | import { APP_BASE_HREF, registerLocaleData } from '@angular/common' | 3 | import { APP_BASE_HREF, registerLocaleData } from '@angular/common' |
4 | import { NgModule } from '@angular/core' | 4 | import { APP_INITIALIZER, NgModule } from '@angular/core' |
5 | import { BrowserModule } from '@angular/platform-browser' | 5 | import { BrowserModule } from '@angular/platform-browser' |
6 | import { ServiceWorkerModule } from '@angular/service-worker' | 6 | import { ServiceWorkerModule } from '@angular/service-worker' |
7 | import localeOc from '@app/helpers/locales/oc' | 7 | import localeOc from '@app/helpers/locales/oc' |
8 | import { AppRoutingModule } from './app-routing.module' | 8 | import { AppRoutingModule } from './app-routing.module' |
9 | import { AppComponent } from './app.component' | 9 | import { AppComponent } from './app.component' |
10 | import { CoreModule } from './core' | 10 | import { CoreModule, ServerService } from './core' |
11 | import { EmptyComponent } from './empty.component' | 11 | import { EmptyComponent } from './empty.component' |
12 | import { HeaderComponent, SearchTypeaheadComponent, SuggestionComponent } from './header' | 12 | import { HeaderComponent, SearchTypeaheadComponent, SuggestionComponent } from './header' |
13 | import { HighlightPipe } from './header/highlight.pipe' | 13 | import { HighlightPipe } from './header/highlight.pipe' |
@@ -26,6 +26,10 @@ import { SharedUserInterfaceSettingsModule } from './shared/shared-user-settings | |||
26 | 26 | ||
27 | registerLocaleData(localeOc, 'oc') | 27 | registerLocaleData(localeOc, 'oc') |
28 | 28 | ||
29 | export function loadConfigFactory (server: ServerService) { | ||
30 | return () => server.loadConfig() | ||
31 | } | ||
32 | |||
29 | @NgModule({ | 33 | @NgModule({ |
30 | bootstrap: [ AppComponent ], | 34 | bootstrap: [ AppComponent ], |
31 | 35 | ||
@@ -67,7 +71,13 @@ registerLocaleData(localeOc, 'oc') | |||
67 | { | 71 | { |
68 | provide: APP_BASE_HREF, | 72 | provide: APP_BASE_HREF, |
69 | useValue: '/' | 73 | useValue: '/' |
70 | } | 74 | }, |
75 | { | ||
76 | provide: APP_INITIALIZER, | ||
77 | useFactory: loadConfigFactory, | ||
78 | deps: [ ServerService ], | ||
79 | multi: true | ||
80 | } | ||
71 | ] | 81 | ] |
72 | }) | 82 | }) |
73 | export class AppModule {} | 83 | export class AppModule {} |