denied + 404
This commit is contained in:
parent
a204a18e99
commit
130250a75a
|
@ -11,6 +11,7 @@ import { SignupComponent } from './pages/signup/signup.component';
|
||||||
import { AdminPageComponent } from './pages/admin-page/admin-page.component';
|
import { AdminPageComponent } from './pages/admin-page/admin-page.component';
|
||||||
import { AuthGuard } from './services/auth.guard';
|
import { AuthGuard } from './services/auth.guard';
|
||||||
import { PageAccountComponent } from './pages/page-account/page-account.component';
|
import { PageAccountComponent } from './pages/page-account/page-account.component';
|
||||||
|
import { PageDeniedComponent } from './pages/page-denied/page-denied.component';
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{ path: '', redirectTo: 'home', pathMatch: 'full' },
|
{ path: '', redirectTo: 'home', pathMatch: 'full' },
|
||||||
|
@ -23,6 +24,7 @@ const routes: Routes = [
|
||||||
{ path: 'Deconnexion', redirectTo: 'home'},
|
{ path: 'Deconnexion', redirectTo: 'home'},
|
||||||
{path: 'restaurants', canActivate: [AuthGuard], /*data : {ROLE : "ROLE_ADMIN"},*/ component: RestoPageComponent},
|
{path: 'restaurants', canActivate: [AuthGuard], /*data : {ROLE : "ROLE_ADMIN"},*/ component: RestoPageComponent},
|
||||||
{path: 'page-not-found',component: PageNotFoundComponent},
|
{path: 'page-not-found',component: PageNotFoundComponent},
|
||||||
|
{path: 'page-denied',component: PageDeniedComponent},
|
||||||
{path: 'admin',canActivate: [AuthGuard],data : {ROLE : "ROLE_ADMIN"}, component: AdminPageComponent},
|
{path: 'admin',canActivate: [AuthGuard],data : {ROLE : "ROLE_ADMIN"}, component: AdminPageComponent},
|
||||||
{path: '**', redirectTo: 'page-not-found' }
|
{path: '**', redirectTo: 'page-not-found' }
|
||||||
];
|
];
|
||||||
|
|
|
@ -26,6 +26,7 @@ import { AuthInterceptor } from './services/auth.interceptor';
|
||||||
import { FavorisUserComponent } from './pages/favoris-user/favoris-user.component';
|
import { FavorisUserComponent } from './pages/favoris-user/favoris-user.component';
|
||||||
import { SignupComponent } from './pages/signup/signup.component';
|
import { SignupComponent } from './pages/signup/signup.component';
|
||||||
import { PageAccountComponent } from './pages/page-account/page-account.component';
|
import { PageAccountComponent } from './pages/page-account/page-account.component';
|
||||||
|
import { PageDeniedComponent } from './pages/page-denied/page-denied.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
|
@ -50,7 +51,8 @@ import { PageAccountComponent } from './pages/page-account/page-account.componen
|
||||||
HeaderLogoComponent,
|
HeaderLogoComponent,
|
||||||
FavorisUserComponent,
|
FavorisUserComponent,
|
||||||
SignupComponent,
|
SignupComponent,
|
||||||
PageAccountComponent
|
PageAccountComponent,
|
||||||
|
PageDeniedComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
<p>page-denied works!</p>
|
|
@ -0,0 +1,25 @@
|
||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { PageDeniedComponent } from './page-denied.component';
|
||||||
|
|
||||||
|
describe('PageDeniedComponent', () => {
|
||||||
|
let component: PageDeniedComponent;
|
||||||
|
let fixture: ComponentFixture<PageDeniedComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
declarations: [ PageDeniedComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(PageDeniedComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,15 @@
|
||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-page-denied',
|
||||||
|
templateUrl: './page-denied.component.html',
|
||||||
|
styleUrls: ['./page-denied.component.scss']
|
||||||
|
})
|
||||||
|
export class PageDeniedComponent implements OnInit {
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1 +1,5 @@
|
||||||
<p>page-not-found works!</p>
|
<main class="content">
|
||||||
|
<!-- <h2>Sorry...Page not found</h2> -->
|
||||||
|
<img class="fond" src="assets/fond404.jpeg">
|
||||||
|
|
||||||
|
</main>
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
.content{
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.fond{
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 7vh;
|
||||||
|
|
||||||
|
}
|
|
@ -7,7 +7,9 @@ import { Component, OnInit } from '@angular/core';
|
||||||
})
|
})
|
||||||
export class PageNotFoundComponent implements OnInit {
|
export class PageNotFoundComponent implements OnInit {
|
||||||
|
|
||||||
constructor() { }
|
constructor() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ export class AuthGuard implements CanActivate {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(route.data['ROLE'] && route.data['ROLE'] != localStorage.getItem('ROLE')){
|
if(route.data['ROLE'] && route.data['ROLE'] != localStorage.getItem('ROLE')){
|
||||||
this.router.navigate(['page-not-found']);
|
this.router.navigate(['page-denied']);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 668 KiB |
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
export const environment = {
|
export const environment = {
|
||||||
production: false,
|
production: false,
|
||||||
apiUrl: "http://localhost:8080",
|
apiUrl: "http://localhost:8081",
|
||||||
tokenKey: "TOKEN-SIMPLEAT"
|
tokenKey: "TOKEN-SIMPLEAT"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue