mirror of https://github.com/Chocobozzz/PeerTube
Wait config before loading login/signup
parent
ad5718261d
commit
f3ae606caf
|
@ -19,6 +19,7 @@ import { ToastModule } from 'primeng/toast'
|
||||||
import { Notifier } from './notification'
|
import { Notifier } from './notification'
|
||||||
import { MessageService } from 'primeng/api'
|
import { MessageService } from 'primeng/api'
|
||||||
import { UserNotificationSocket } from '@app/core/notification/user-notification-socket.service'
|
import { UserNotificationSocket } from '@app/core/notification/user-notification-socket.service'
|
||||||
|
import { ServerConfigResolver } from './routing/server-config-resolver.service'
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
@ -60,7 +61,8 @@ import { UserNotificationSocket } from '@app/core/notification/user-notification
|
||||||
RedirectService,
|
RedirectService,
|
||||||
Notifier,
|
Notifier,
|
||||||
MessageService,
|
MessageService,
|
||||||
UserNotificationSocket
|
UserNotificationSocket,
|
||||||
|
ServerConfigResolver
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class CoreModule {
|
export class CoreModule {
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
import { Injectable } from '@angular/core'
|
||||||
|
import { Resolve } from '@angular/router'
|
||||||
|
import { ServerService } from '@app/core/server'
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class ServerConfigResolver implements Resolve<boolean> {
|
||||||
|
constructor (
|
||||||
|
private server: ServerService
|
||||||
|
) {}
|
||||||
|
|
||||||
|
resolve () {
|
||||||
|
// FIXME: directly returning this.server.configLoaded does not seem to work
|
||||||
|
return new Promise<boolean>(res => {
|
||||||
|
return this.server.configLoaded.subscribe(() => res(true))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,9 +1,8 @@
|
||||||
import { NgModule } from '@angular/core'
|
import { NgModule } from '@angular/core'
|
||||||
import { RouterModule, Routes } from '@angular/router'
|
import { RouterModule, Routes } from '@angular/router'
|
||||||
|
|
||||||
import { MetaGuard } from '@ngx-meta/core'
|
import { MetaGuard } from '@ngx-meta/core'
|
||||||
|
|
||||||
import { LoginComponent } from './login.component'
|
import { LoginComponent } from './login.component'
|
||||||
|
import { ServerConfigResolver } from '@app/core/routing/server-config-resolver.service'
|
||||||
|
|
||||||
const loginRoutes: Routes = [
|
const loginRoutes: Routes = [
|
||||||
{
|
{
|
||||||
|
@ -14,6 +13,9 @@ const loginRoutes: Routes = [
|
||||||
meta: {
|
meta: {
|
||||||
title: 'Login'
|
title: 'Login'
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
serverConfigLoaded: ServerConfigResolver
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
import { NgModule } from '@angular/core'
|
import { NgModule } from '@angular/core'
|
||||||
import { RouterModule, Routes } from '@angular/router'
|
import { RouterModule, Routes } from '@angular/router'
|
||||||
|
|
||||||
import { MetaGuard } from '@ngx-meta/core'
|
import { MetaGuard } from '@ngx-meta/core'
|
||||||
|
|
||||||
import { SignupComponent } from './signup.component'
|
import { SignupComponent } from './signup.component'
|
||||||
|
import { ServerConfigResolver } from '@app/core/routing/server-config-resolver.service'
|
||||||
|
|
||||||
const signupRoutes: Routes = [
|
const signupRoutes: Routes = [
|
||||||
{
|
{
|
||||||
|
@ -14,6 +13,9 @@ const signupRoutes: Routes = [
|
||||||
meta: {
|
meta: {
|
||||||
title: 'Signup'
|
title: 'Signup'
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
serverConfigLoaded: ServerConfigResolver
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue