Only page not found when no routing is matched on production environment
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit

This commit is contained in:
Peter Bastiani 2024-01-30 09:54:00 +01:00
parent 7ba35052ec
commit af9acebaff
2 changed files with 13 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import {NavBarGuard} from './services/nav-bar-guard.service';
import {FullScreenGuard} from './services/full-screen-guard.service'; import {FullScreenGuard} from './services/full-screen-guard.service';
import {SessionClearedComponent} from './components/session-cleared/session-cleared.component'; import {SessionClearedComponent} from './components/session-cleared/session-cleared.component';
import {NotFoundComponent} from './components/not-found/not-found.component'; import {NotFoundComponent} from './components/not-found/not-found.component';
import { ProductionGuard } from './services/production-guard.service';
const routes = [ const routes = [
@ -21,7 +22,7 @@ const routes = [
}, },
{ {
path: '**', component: NotFoundComponent, path: '**', component: NotFoundComponent,
canActivate: [NavBarGuard] canActivate: [NavBarGuard, ProductionGuard]
} }
]; ];

View File

@ -0,0 +1,11 @@
import { Injectable } from '@angular/core';
import { environment } from 'src/environments/environment';
@Injectable({
providedIn: 'root',
})
export class ProductionGuard {
canActivate(): boolean {
return environment.production;
}
}