|
@ -14,20 +14,6 @@ import { catchError } from 'rxjs/operators'; |
|
|
|
|
|
|
|
|
@Injectable({ providedIn: 'root' }) |
|
|
@Injectable({ providedIn: 'root' }) |
|
|
export class AuthGuard { |
|
|
export class AuthGuard { |
|
|
private static PUBLIC_PAGE_ROUTES = [ |
|
|
|
|
|
`/${publicRoutes.about.path}`, |
|
|
|
|
|
`/${publicRoutes.blog.path}`, |
|
|
|
|
|
`/${publicRoutes.demo.path}`, |
|
|
|
|
|
`/${publicRoutes.faq.path}`, |
|
|
|
|
|
`/${publicRoutes.features.path}`, |
|
|
|
|
|
`/${publicRoutes.markets.path}`, |
|
|
|
|
|
`/${publicRoutes.openStartup.path}`, |
|
|
|
|
|
`/${publicRoutes.pricing.path}`, |
|
|
|
|
|
`/${publicRoutes.public.path}`, |
|
|
|
|
|
`/${publicRoutes.register.path}`, |
|
|
|
|
|
`/${publicRoutes.resources.path}` |
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
public constructor( |
|
|
public constructor( |
|
|
private dataService: DataService, |
|
|
private dataService: DataService, |
|
|
private router: Router, |
|
|
private router: Router, |
|
@ -54,10 +40,14 @@ export class AuthGuard { |
|
|
this.router.navigate(publicRoutes.register.routerLink); |
|
|
this.router.navigate(publicRoutes.register.routerLink); |
|
|
resolve(false); |
|
|
resolve(false); |
|
|
} else if ( |
|
|
} else if ( |
|
|
AuthGuard.PUBLIC_PAGE_ROUTES.some((publicPageRoute) => { |
|
|
Object.values(publicRoutes) |
|
|
const [, url] = decodeURIComponent(state.url).split('/'); |
|
|
.map(({ path }) => { |
|
|
return `/${url}` === publicPageRoute; |
|
|
return `/${path}`; |
|
|
}) |
|
|
}) |
|
|
|
|
|
.some((publicPageRoute) => { |
|
|
|
|
|
const [, url] = decodeURIComponent(state.url).split('/'); |
|
|
|
|
|
return `/${url}` === publicPageRoute; |
|
|
|
|
|
}) |
|
|
) { |
|
|
) { |
|
|
resolve(true); |
|
|
resolve(true); |
|
|
return EMPTY; |
|
|
return EMPTY; |
|
|