Просмотр исходного кода

added 403 page for catch all errors.

tags/2.037
Patrick Sun 4 лет назад
Родитель
Сommit
2b0a2036f7
7 измененных файлов: 109 добавлений и 3 удалений
  1. +2
    -0
      src/app/app-routing.module.ts
  2. +3
    -1
      src/app/app.module.ts
  3. +16
    -2
      src/app/auth/auth.component.ts
  4. +10
    -0
      src/app/e403/e403.component.html
  5. +38
    -0
      src/app/e403/e403.component.scss
  6. +25
    -0
      src/app/e403/e403.component.spec.ts
  7. +15
    -0
      src/app/e403/e403.component.ts

+ 2
- 0
src/app/app-routing.module.ts Просмотреть файл

@@ -13,6 +13,7 @@ import {BrokerRewardComponent} from './broker-reward/broker-reward.component';
import {BrokerProfileComponent} from './broker-profile/broker-profile.component';
import {ClientLoanListComponent} from './client-loan-list/client-loan-list.component';
import {ClientProfileComponent} from './client-profile/client-profile.component';
import {E403Component} from './e403/e403.component';


const routes: Routes = [
@@ -31,6 +32,7 @@ const routes: Routes = [
{path : 'broker-profile', component: BrokerProfileComponent, },
{path : 'client-loan-list', component: ClientLoanListComponent, },
{path : 'client-profile', component: ClientProfileComponent, },
{path : 'e403', component: E403Component, },
];

@NgModule({

+ 3
- 1
src/app/app.module.ts Просмотреть файл

@@ -70,6 +70,7 @@ import { BrokerRewardComponent } from './broker-reward/broker-reward.component';
import { BrokerProfileComponent } from './broker-profile/broker-profile.component';
import { ClientLoanListComponent } from './client-loan-list/client-loan-list.component';
import { ClientProfileComponent } from './client-profile/client-profile.component';
import { E403Component } from './e403/e403.component';



@@ -110,7 +111,8 @@ import { ClientProfileComponent } from './client-profile/client-profile.componen
BrokerRewardComponent,
BrokerProfileComponent,
ClientLoanListComponent,
ClientProfileComponent
ClientProfileComponent,
E403Component
],
imports: [
BrowserModule,

+ 16
- 2
src/app/auth/auth.component.ts Просмотреть файл

@@ -43,11 +43,25 @@ export class AuthComponent implements OnInit, OnDestroy{
this.authService.login(this.userForm.value.email, this.userForm.value.password);
}

public onLogin(rsp: apiV1LoginResponse) {
public onLogin(rsp: apiV1LoginResponse): void {
this.loading = false;
// console.log ('found login ' , rsp );
if (rsp.login) {
this.router.navigate(['/dashboard']);
switch ( rsp.role ) {
case 'admin':
this.router.navigate(['/dashboard']);
break;
case 'broker':
this.router.navigate(['/broker-loan-list']);
break;
case 'user':
this.router.navigate(['/client-loan-list']);
break;
default:
this.router.navigate(['/e403']);
break;
}

}
else {
this.show();

+ 10
- 0
src/app/e403/e403.component.html Просмотреть файл

@@ -0,0 +1,10 @@
<div class="body">
<article>
<h1>Page&rsquo;s not available!</h1>
<div>
<p>Sorry for the inconvenience but you&rsquo;re not allowed to visit this page <p>
Please feel free to <a href="https://sfmarkets.com.au">contact us</a>, otherwise please try other links</p>
<p>&mdash; The Team</p>
</div>
</article>
</div>

+ 38
- 0
src/app/e403/e403.component.scss Просмотреть файл

@@ -0,0 +1,38 @@
div.body {
text-align: center;
padding: 150px;
display: table;
width: 100%;
height: 100vh;
opacity: 0.95;
background: url('../../assets/img/body_bg.jpg') no-repeat center center fixed;
background-size: cover;
}

h1 {
font-size: 50px;
}

body {
font: 20px Helvetica, sans-serif;
color: #333;
}

article {
display: block;
text-align: left;
width: 650px;
margin: 0 auto;
}

a {
color: #dc8100;
text-decoration: none;
}

a:hover {
color: #333;
text-decoration: none;
}



+ 25
- 0
src/app/e403/e403.component.spec.ts Просмотреть файл

@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { E403Component } from './e403.component';

describe('E403Component', () => {
let component: E403Component;
let fixture: ComponentFixture<E403Component>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ E403Component ]
})
.compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(E403Component);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});

+ 15
- 0
src/app/e403/e403.component.ts Просмотреть файл

@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'app-e403',
templateUrl: './e403.component.html',
styleUrls: ['./e403.component.scss']
})
export class E403Component implements OnInit {

constructor() { }

ngOnInit(): void {
}

}

Загрузка…
Отмена
Сохранить