Bugfix/fix missing header of public pages (#121)
* Fix missing header of public pages * Update changelog
This commit is contained in:
parent
c16f743b07
commit
ad961f3039
@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fixed the performance chart by considering the investment
|
- Fixed the performance chart by considering the investment
|
||||||
|
- Fixed missing header of public pages (_About_, _Pricing_, _Resources_)
|
||||||
|
|
||||||
## 1.7.0 - 22.05.2021
|
## 1.7.0 - 22.05.2021
|
||||||
|
|
||||||
|
@ -9,14 +9,14 @@ import { ViewMode } from '@prisma/client';
|
|||||||
import { EMPTY } from 'rxjs';
|
import { EMPTY } from 'rxjs';
|
||||||
import { catchError } from 'rxjs/operators';
|
import { catchError } from 'rxjs/operators';
|
||||||
|
|
||||||
import { DataService } from '../services/data.service';
|
|
||||||
import { SettingsStorageService } from '../services/settings-storage.service';
|
import { SettingsStorageService } from '../services/settings-storage.service';
|
||||||
import { UserService } from '../services/user/user.service';
|
import { UserService } from '../services/user/user.service';
|
||||||
|
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class AuthGuard implements CanActivate {
|
export class AuthGuard implements CanActivate {
|
||||||
|
private static PUBLIC_PAGE_ROUTES = ['/about', '/pricing', '/resources'];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private dataService: DataService,
|
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private settingsStorageService: SettingsStorageService,
|
private settingsStorageService: SettingsStorageService,
|
||||||
private userService: UserService
|
private userService: UserService
|
||||||
@ -35,7 +35,10 @@ export class AuthGuard implements CanActivate {
|
|||||||
.get()
|
.get()
|
||||||
.pipe(
|
.pipe(
|
||||||
catchError(() => {
|
catchError(() => {
|
||||||
if (state.url !== '/start') {
|
if (AuthGuard.PUBLIC_PAGE_ROUTES.includes(state.url)) {
|
||||||
|
resolve(true);
|
||||||
|
return EMPTY;
|
||||||
|
} else if (state.url !== '/start') {
|
||||||
this.router.navigate(['/start']);
|
this.router.navigate(['/start']);
|
||||||
resolve(false);
|
resolve(false);
|
||||||
return EMPTY;
|
return EMPTY;
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { RouterModule, Routes } from '@angular/router';
|
import { RouterModule, Routes } from '@angular/router';
|
||||||
|
import { AuthGuard } from '@ghostfolio/client/core/auth.guard';
|
||||||
|
|
||||||
import { AboutPageComponent } from './about-page.component';
|
import { AboutPageComponent } from './about-page.component';
|
||||||
|
|
||||||
const routes: Routes = [{ path: '', component: AboutPageComponent }];
|
const routes: Routes = [
|
||||||
|
{ path: '', component: AboutPageComponent, canActivate: [AuthGuard] }
|
||||||
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [RouterModule.forChild(routes)],
|
imports: [RouterModule.forChild(routes)],
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { RouterModule, Routes } from '@angular/router';
|
import { RouterModule, Routes } from '@angular/router';
|
||||||
|
import { AuthGuard } from '@ghostfolio/client/core/auth.guard';
|
||||||
|
|
||||||
import { PricingPageComponent } from './pricing-page.component';
|
import { PricingPageComponent } from './pricing-page.component';
|
||||||
|
|
||||||
const routes: Routes = [{ path: '', component: PricingPageComponent }];
|
const routes: Routes = [
|
||||||
|
{ path: '', component: PricingPageComponent, canActivate: [AuthGuard] }
|
||||||
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [RouterModule.forChild(routes)],
|
imports: [RouterModule.forChild(routes)],
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { RouterModule, Routes } from '@angular/router';
|
import { RouterModule, Routes } from '@angular/router';
|
||||||
|
import { AuthGuard } from '@ghostfolio/client/core/auth.guard';
|
||||||
|
|
||||||
import { ResourcesPageComponent } from './resources-page.component';
|
import { ResourcesPageComponent } from './resources-page.component';
|
||||||
|
|
||||||
const routes: Routes = [{ path: '', component: ResourcesPageComponent }];
|
const routes: Routes = [
|
||||||
|
{ path: '', component: ResourcesPageComponent, canActivate: [AuthGuard] }
|
||||||
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [RouterModule.forChild(routes)],
|
imports: [RouterModule.forChild(routes)],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user