Merge branch 'paul' into Romain

This commit is contained in:
Romain Verger 2022-03-09 16:43:03 +01:00
commit 9eca5174d5
12 changed files with 66 additions and 6 deletions

View File

@ -11,6 +11,7 @@ import { SignupComponent } from './pages/signup/signup.component';
import { AdminPageComponent } from './pages/admin-page/admin-page.component';
import { AuthGuard } from './services/auth.guard';
import { PageAccountComponent } from './pages/page-account/page-account.component';
import { PageDeniedComponent } from './pages/page-denied/page-denied.component';
const routes: Routes = [
{ path: '', redirectTo: 'home', pathMatch: 'full' },
@ -23,6 +24,7 @@ const routes: Routes = [
{ path: 'Deconnexion', redirectTo: 'home'},
{path: 'restaurants', canActivate: [AuthGuard], /*data : {ROLE : "ROLE_ADMIN"},*/ component: RestoPageComponent},
{path: 'page-not-found',component: PageNotFoundComponent},
{path: 'page-denied',component: PageDeniedComponent},
{path: 'admin',canActivate: [AuthGuard],data : {ROLE : "ROLE_ADMIN"}, component: AdminPageComponent},
{path: '**', redirectTo: 'page-not-found' }
];

View File

@ -26,7 +26,7 @@ import { AuthInterceptor } from './services/auth.interceptor';
import { FavorisUserComponent } from './pages/favoris-user/favoris-user.component';
import { SignupComponent } from './pages/signup/signup.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({
declarations: [
@ -52,7 +52,7 @@ import { PageAccesDeniedComponent } from './pages/page-acces-denied/page-acces-d
FavorisUserComponent,
SignupComponent,
PageAccountComponent,
PageAccesDeniedComponent
PageDeniedComponent
],
imports: [
BrowserModule,

View File

@ -0,0 +1 @@
<p>page-denied works!</p>

View 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();
});
});

View 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 {
}
}

View File

@ -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>

View File

@ -0,0 +1,11 @@
.content{
width: 100%;
height: auto;
display: flex;
justify-content: center;
}
.fond{
width: 100%;
margin-top: 7vh;
}

View File

@ -7,7 +7,9 @@ import { Component, OnInit } from '@angular/core';
})
export class PageNotFoundComponent implements OnInit {
constructor() { }
constructor() {
}
ngOnInit(): void {
}

View File

@ -43,7 +43,7 @@ export class AuthGuard implements CanActivate {
}
if(route.data['ROLE'] && route.data['ROLE'] != localStorage.getItem('ROLE')){
this.router.navigate(['page-not-found']);
this.router.navigate(['page-denied']);
return false;
}
}

BIN
src/assets/fond404.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 668 KiB

View File

@ -4,7 +4,7 @@
export const environment = {
production: false,
apiUrl: "http://localhost:8080",
apiUrl: "http://localhost:8081",
tokenKey: "TOKEN-SIMPLEAT"
};