aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/core
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-04-25 10:40:01 +0200
committerChocobozzz <me@florianbigard.com>2019-04-25 10:40:01 +0200
commitf3ae606caf74c8a173ce44bf3f913f1488f97d7f (patch)
tree62c5ba100ab8402ee482711b3b411c6ad16f58f9 /client/src/app/core
parentad5718261dba5846802bf91bf848423b1774b04f (diff)
downloadPeerTube-f3ae606caf74c8a173ce44bf3f913f1488f97d7f.tar.gz
PeerTube-f3ae606caf74c8a173ce44bf3f913f1488f97d7f.tar.zst
PeerTube-f3ae606caf74c8a173ce44bf3f913f1488f97d7f.zip
Wait config before loading login/signup
Diffstat (limited to 'client/src/app/core')
-rw-r--r--client/src/app/core/core.module.ts4
-rw-r--r--client/src/app/core/routing/server-config-resolver.service.ts17
2 files changed, 20 insertions, 1 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}