Skip to content
Snippets Groups Projects
Commit 1beaef64 authored by Florent Poittevin's avatar Florent Poittevin
Browse files

Add routing

parent bcc93897
No related branches found
No related tags found
1 merge request!3Develop
Showing
with 120 additions and 31 deletions
import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import {AccessViewComponent} from '@app/access/views/access-view/access-view.component';
import {HomeComponent} from '@app/components/home/home.component';
import {LoginComponent} from '@app/components/login/login.component';
import {PageNotFoundComponent} from '@app/components/page-not-found/page-not-found.component';
import {DepositViewComponent} from '@app/deposit/views/deposit-view/deposit-view.component';
const routes: Routes = [];
const routes: Routes = [
{path: 'access', component: AccessViewComponent},
{path: 'deposit', component: DepositViewComponent},
{path: 'login', component: LoginComponent},
{path: '', component: HomeComponent},
{path: '', redirectTo: '/', pathMatch: 'full'},
{path: '**', component: PageNotFoundComponent},
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
......
......@@ -2,11 +2,9 @@
Welcome to {{ title }}!
</h1>
<button (click)="test()">Get Organizations Units</button>
<!--<dlcm-home></dlcm-home>-->
<dlcm-home></dlcm-home>
<dlcm-deposit-view></dlcm-deposit-view>
<!--<dlcm-deposit-view></dlcm-deposit-view>-->
<router-outlet></router-outlet>
......@@ -11,7 +11,8 @@ import {AppService} from './app.service';
export class AppComponent {
title = 'DLCM-Frontend';
constructor(private oauthService: OAuthService, private appService: AppService) {
constructor(private oauthService: OAuthService,
private appService: AppService) {
this.checkTokenInUrl();
}
......@@ -27,8 +28,4 @@ export class AppComponent {
this.oauthService.tryLogin(option);
}
test() {
this.appService.getOrganizationUnits();
}
}
import {HTTP_INTERCEPTORS, HttpClientModule} from '@angular/common/http';
import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {AccessModule} from '@app/access/access.module';
import {DepositModule} from '@app/deposit/deposit.module';
import {DepositState} from '@app/deposit/deposit.state';
import {SharedModule} from '@app/shared/shared.module';
import {NgxsModule} from '@ngxs/store';
import {AuthConfig, JwksValidationHandler, OAuthModule, OAuthModuleConfig, OAuthStorage, ValidationHandler} from 'angular-oauth2-oidc';
import {AppRoutingModule} from './app-routing.module';
import {AppComponent} from './app.component';
import {HomeComponent} from './home/home.component';
import {DlcmInterceptor} from './dlcm.interceptor';
import {authConfig, authModuleConfig} from './auth.config';
import {AppService} from './app.service';
import {SharedModule} from '@app/shared/shared.module';
import {AccessModule} from '@app/access/access.module';
import {DepositModule} from '@app/deposit/deposit.module';
import {DepositState} from '@app/deposit/deposit.state';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {CommonModule} from '@angular/common';
import {MaterialModule} from '@app/material.module';
import {authConfig, authModuleConfig} from './auth.config';
import {DlcmInterceptor} from './dlcm.interceptor';
import {HomeComponent} from './components/home/home.component';
import { PageNotFoundComponent } from './components/page-not-found/page-not-found.component';
import { LoginComponent } from './components/login/login.component';
@NgModule({
declarations: [
AppComponent,
HomeComponent,
PageNotFoundComponent,
LoginComponent,
],
imports: [
BrowserModule,
......
<div>
Token : {{token}}
</div>
<div>
Claims : {{claims}}
</div>
......@@ -18,8 +18,4 @@ export class HomeComponent {
get claims() {
return this.oauthService.getIdentityClaims();
}
login() {
this.oauthService.initImplicitFlow();
}
}
<div>
Token : {{token}}
</div>
<div>
Claims : {{claims}}
</div>
<button class="btn btn-default" (click)="login()">
Login
</button>
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { LoginComponent } from './login.component';
describe('LoginComponent', () => {
let component: LoginComponent;
let fixture: ComponentFixture<LoginComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LoginComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(LoginComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import {Component, OnInit} from '@angular/core';
import {OAuthService} from 'angular-oauth2-oidc';
@Component({
selector: 'dlcm-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.scss'],
})
export class LoginComponent implements OnInit {
constructor(private oauthService: OAuthService) {
}
ngOnInit() {
}
login() {
this.oauthService.initImplicitFlow();
}
}
<h1>Page not found</h1>
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { PageNotFoundComponent } from './page-not-found.component';
describe('PageNotFoundComponent', () => {
let component: PageNotFoundComponent;
let fixture: ComponentFixture<PageNotFoundComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ PageNotFoundComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(PageNotFoundComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'dlcm-page-not-found',
templateUrl: './page-not-found.component.html',
styleUrls: ['./page-not-found.component.scss']
})
export class PageNotFoundComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment