diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index e58f922..1e5ad82 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -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' } ]; diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 1bf74dd..1441df1 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -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, diff --git a/src/app/pages/page-denied/page-denied.component.html b/src/app/pages/page-denied/page-denied.component.html new file mode 100644 index 0000000..b958ab7 --- /dev/null +++ b/src/app/pages/page-denied/page-denied.component.html @@ -0,0 +1 @@ +

page-denied works!

diff --git a/src/app/pages/page-denied/page-denied.component.scss b/src/app/pages/page-denied/page-denied.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pages/page-denied/page-denied.component.spec.ts b/src/app/pages/page-denied/page-denied.component.spec.ts new file mode 100644 index 0000000..f69e906 --- /dev/null +++ b/src/app/pages/page-denied/page-denied.component.spec.ts @@ -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; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ PageDeniedComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(PageDeniedComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/page-denied/page-denied.component.ts b/src/app/pages/page-denied/page-denied.component.ts new file mode 100644 index 0000000..7166b66 --- /dev/null +++ b/src/app/pages/page-denied/page-denied.component.ts @@ -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 { + } + +} diff --git a/src/app/pages/page-not-found/page-not-found.component.html b/src/app/pages/page-not-found/page-not-found.component.html index cc75e49..fa62fad 100644 --- a/src/app/pages/page-not-found/page-not-found.component.html +++ b/src/app/pages/page-not-found/page-not-found.component.html @@ -1 +1,5 @@ -

page-not-found works!

+
+ + + +
diff --git a/src/app/pages/page-not-found/page-not-found.component.scss b/src/app/pages/page-not-found/page-not-found.component.scss index e69de29..0c739f8 100644 --- a/src/app/pages/page-not-found/page-not-found.component.scss +++ b/src/app/pages/page-not-found/page-not-found.component.scss @@ -0,0 +1,11 @@ +.content{ + width: 100%; + height: auto; + display: flex; + justify-content: center; +} +.fond{ + width: 100%; + margin-top: 7vh; + +} \ No newline at end of file diff --git a/src/app/pages/page-not-found/page-not-found.component.ts b/src/app/pages/page-not-found/page-not-found.component.ts index 5faa15b..d1aa667 100644 --- a/src/app/pages/page-not-found/page-not-found.component.ts +++ b/src/app/pages/page-not-found/page-not-found.component.ts @@ -7,7 +7,9 @@ import { Component, OnInit } from '@angular/core'; }) export class PageNotFoundComponent implements OnInit { - constructor() { } + constructor() { + + } ngOnInit(): void { } diff --git a/src/app/services/auth.guard.ts b/src/app/services/auth.guard.ts index 87a7b9e..0d34584 100644 --- a/src/app/services/auth.guard.ts +++ b/src/app/services/auth.guard.ts @@ -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; } } diff --git a/src/assets/fond404.jpeg b/src/assets/fond404.jpeg new file mode 100644 index 0000000..c18b802 Binary files /dev/null and b/src/assets/fond404.jpeg differ diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 2d9b681..04827d4 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -4,7 +4,7 @@ export const environment = { production: false, - apiUrl: "http://localhost:8080", + apiUrl: "http://localhost:8081", tokenKey: "TOKEN-SIMPLEAT" };