aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--client/src/app/core/core.module.ts4
-rw-r--r--client/src/app/core/routing/server-config-resolver.service.ts17
-rw-r--r--client/src/app/login/login-routing.module.ts6
-rw-r--r--client/src/app/signup/signup-routing.module.ts6
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'
19import { Notifier } from './notification' 19import { Notifier } from './notification'
20import { MessageService } from 'primeng/api' 20import { MessageService } from 'primeng/api'
21import { UserNotificationSocket } from '@app/core/notification/user-notification-socket.service' 21import { UserNotificationSocket } from '@app/core/notification/user-notification-socket.service'
22import { 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})
66export class CoreModule { 68export 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 @@
1import { Injectable } from '@angular/core'
2import { Resolve } from '@angular/router'
3import { ServerService } from '@app/core/server'
4
5@Injectable()
6export 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 @@
1import { NgModule } from '@angular/core' 1import { NgModule } from '@angular/core'
2import { RouterModule, Routes } from '@angular/router' 2import { RouterModule, Routes } from '@angular/router'
3
4import { MetaGuard } from '@ngx-meta/core' 3import { MetaGuard } from '@ngx-meta/core'
5
6import { LoginComponent } from './login.component' 4import { LoginComponent } from './login.component'
5import { ServerConfigResolver } from '@app/core/routing/server-config-resolver.service'
7 6
8const loginRoutes: Routes = [ 7const 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 @@
1import { NgModule } from '@angular/core' 1import { NgModule } from '@angular/core'
2import { RouterModule, Routes } from '@angular/router' 2import { RouterModule, Routes } from '@angular/router'
3
4import { MetaGuard } from '@ngx-meta/core' 3import { MetaGuard } from '@ngx-meta/core'
5
6import { SignupComponent } from './signup.component' 4import { SignupComponent } from './signup.component'
5import { ServerConfigResolver } from '@app/core/routing/server-config-resolver.service'
7 6
8const signupRoutes: Routes = [ 7const 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]