Merge branch 'paul' into Romain
This commit is contained in:
commit
9eca5174d5
@ -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,7 +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 { PageAccesDeniedComponent } from './pages/page-acces-denied/page-acces-denied.component';
|
import { PageDeniedComponent } from './pages/page-denied/page-denied.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
@ -52,7 +52,7 @@ import { PageAccesDeniedComponent } from './pages/page-acces-denied/page-acces-d
|
|||||||
FavorisUserComponent,
|
FavorisUserComponent,
|
||||||
SignupComponent,
|
SignupComponent,
|
||||||
PageAccountComponent,
|
PageAccountComponent,
|
||||||
PageAccesDeniedComponent
|
PageDeniedComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
|
1
src/app/pages/page-denied/page-denied.component.html
Normal file
1
src/app/pages/page-denied/page-denied.component.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<p>page-denied works!</p>
|
25
src/app/pages/page-denied/page-denied.component.spec.ts
Normal file
25
src/app/pages/page-denied/page-denied.component.spec.ts
Normal file
@ -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();
|
||||||
|
});
|
||||||
|
});
|
15
src/app/pages/page-denied/page-denied.component.ts
Normal file
15
src/app/pages/page-denied/page-denied.component.ts
Normal file
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BIN
src/assets/fond404.jpeg
Normal file
BIN
src/assets/fond404.jpeg
Normal file
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
Block a user