diff options
-rw-r--r-- | client/src/app/core/core.module.ts | 4 | ||||
-rw-r--r-- | client/src/app/core/routing/server-config-resolver.service.ts | 17 | ||||
-rw-r--r-- | client/src/app/login/login-routing.module.ts | 6 | ||||
-rw-r--r-- | client/src/app/signup/signup-routing.module.ts | 6 |
4 files changed, 28 insertions, 5 deletions
diff --git a/client/src/app/core/core.module.ts b/client/src/app/core/core.module.ts index 4ef3b1e73..d3e72afb4 100644 --- a/client/src/app/core/core.module.ts +++ b/client/src/app/core/core.module.ts | |||
@@ -19,6 +19,7 @@ import { ToastModule } from 'primeng/toast' | |||
19 | import { Notifier } from './notification' | 19 | import { Notifier } from './notification' |
20 | import { MessageService } from 'primeng/api' | 20 | import { MessageService } from 'primeng/api' |
21 | import { UserNotificationSocket } from '@app/core/notification/user-notification-socket.service' | 21 | import { UserNotificationSocket } from '@app/core/notification/user-notification-socket.service' |
22 | import { ServerConfigResolver } from './routing/server-config-resolver.service' | ||
22 | 23 | ||
23 | @NgModule({ | 24 | @NgModule({ |
24 | imports: [ | 25 | imports: [ |
@@ -60,7 +61,8 @@ import { UserNotificationSocket } from '@app/core/notification/user-notification | |||
60 | RedirectService, | 61 | RedirectService, |
61 | Notifier, | 62 | Notifier, |
62 | MessageService, | 63 | MessageService, |
63 | UserNotificationSocket | 64 | UserNotificationSocket, |
65 | ServerConfigResolver | ||
64 | ] | 66 | ] |
65 | }) | 67 | }) |
66 | export class CoreModule { | 68 | export class CoreModule { |
diff --git a/client/src/app/core/routing/server-config-resolver.service.ts b/client/src/app/core/routing/server-config-resolver.service.ts new file mode 100644 index 000000000..ec7d6428f --- /dev/null +++ b/client/src/app/core/routing/server-config-resolver.service.ts | |||
@@ -0,0 +1,17 @@ | |||
1 | import { Injectable } from '@angular/core' | ||
2 | import { Resolve } from '@angular/router' | ||
3 | import { ServerService } from '@app/core/server' | ||
4 | |||
5 | @Injectable() | ||
6 | export class ServerConfigResolver implements Resolve<boolean> { | ||
7 | constructor ( | ||
8 | private server: ServerService | ||
9 | ) {} | ||
10 | |||
11 | resolve () { | ||
12 | // FIXME: directly returning this.server.configLoaded does not seem to work | ||
13 | return new Promise<boolean>(res => { | ||
14 | return this.server.configLoaded.subscribe(() => res(true)) | ||
15 | }) | ||
16 | } | ||
17 | } | ||
diff --git a/client/src/app/login/login-routing.module.ts b/client/src/app/login/login-routing.module.ts index 4d8913041..5a41f4e7e 100644 --- a/client/src/app/login/login-routing.module.ts +++ b/client/src/app/login/login-routing.module.ts | |||
@@ -1,9 +1,8 @@ | |||
1 | import { NgModule } from '@angular/core' | 1 | import { NgModule } from '@angular/core' |
2 | import { RouterModule, Routes } from '@angular/router' | 2 | import { RouterModule, Routes } from '@angular/router' |
3 | |||
4 | import { MetaGuard } from '@ngx-meta/core' | 3 | import { MetaGuard } from '@ngx-meta/core' |
5 | |||
6 | import { LoginComponent } from './login.component' | 4 | import { LoginComponent } from './login.component' |
5 | import { ServerConfigResolver } from '@app/core/routing/server-config-resolver.service' | ||
7 | 6 | ||
8 | const loginRoutes: Routes = [ | 7 | const loginRoutes: Routes = [ |
9 | { | 8 | { |
@@ -14,6 +13,9 @@ const loginRoutes: Routes = [ | |||
14 | meta: { | 13 | meta: { |
15 | title: 'Login' | 14 | title: 'Login' |
16 | } | 15 | } |
16 | }, | ||
17 | resolve: { | ||
18 | serverConfigLoaded: ServerConfigResolver | ||
17 | } | 19 | } |
18 | } | 20 | } |
19 | ] | 21 | ] |
diff --git a/client/src/app/signup/signup-routing.module.ts b/client/src/app/signup/signup-routing.module.ts index b7ac69b53..820d16d4d 100644 --- a/client/src/app/signup/signup-routing.module.ts +++ b/client/src/app/signup/signup-routing.module.ts | |||
@@ -1,9 +1,8 @@ | |||
1 | import { NgModule } from '@angular/core' | 1 | import { NgModule } from '@angular/core' |
2 | import { RouterModule, Routes } from '@angular/router' | 2 | import { RouterModule, Routes } from '@angular/router' |
3 | |||
4 | import { MetaGuard } from '@ngx-meta/core' | 3 | import { MetaGuard } from '@ngx-meta/core' |
5 | |||
6 | import { SignupComponent } from './signup.component' | 4 | import { SignupComponent } from './signup.component' |
5 | import { ServerConfigResolver } from '@app/core/routing/server-config-resolver.service' | ||
7 | 6 | ||
8 | const signupRoutes: Routes = [ | 7 | const signupRoutes: Routes = [ |
9 | { | 8 | { |
@@ -14,6 +13,9 @@ const signupRoutes: Routes = [ | |||
14 | meta: { | 13 | meta: { |
15 | title: 'Signup' | 14 | title: 'Signup' |
16 | } | 15 | } |
16 | }, | ||
17 | resolve: { | ||
18 | serverConfigLoaded: ServerConfigResolver | ||
17 | } | 19 | } |
18 | } | 20 | } |
19 | ] | 21 | ] |