This commit is contained in:
Nikolaos Laskaris 2017-11-02 11:11:29 +02:00
parent 6f4adf5ab3
commit e84f45d28c
6 changed files with 6 additions and 8 deletions

View File

@ -11,10 +11,10 @@ import { MainSignInComponent } from './login/main-sign-in/main-sign-in.component
const appRoutes: Routes = [
{ path: 'dynamic-form', component: DynamicFormComponent, canActivate: [AuthGuard] },
{ path: 'login-page', component: MainSignInComponent},
{ path: 'login', component: MainSignInComponent},
{ path: 'projects', component: ProjectsComponent},
{ path: 'dmps', component: DmpComponent},
{ path: '', redirectTo: '/login-page', pathMatch: 'full' },
{ path: '', redirectTo: '/login', pathMatch: 'full' },
{ path: '**', component: PageNotFoundComponent },
{
path: '',

View File

@ -29,12 +29,12 @@ export class AppComponent {
login(){
//redirect to login page
this.router.navigate(['/login-page'], { queryParams: { /*returnUrl: this.state.url*/ }});
this.router.navigate(['/login'], { queryParams: { /*returnUrl: this.state.url*/ }});
}
logout(){
this.tokenService.logout();
this.router.navigate(['/login-page'], { queryParams: { /*returnUrl: this.state.url*/ }});
this.router.navigate(['/login'], { queryParams: { /*returnUrl: this.state.url*/ }});
}

View File

@ -18,7 +18,6 @@ import { TokenService, TokenProvider } from './services/login/token.service';
import { LocalStorageService } from 'ngx-webstorage';
import { dataModelBuilder } from './services/dataModelBuilder.service';
import { DynamicFormGroupComponent } from './form/dynamic-form-group/dynamic-form-group.component';
//import { LoginComponent } from './login/login-page';
import { AppRoutingModule } from './app-routing.module';
import { AuthGuard } from './guards/auth.guard';
import { PageNotFoundComponent } from './not-found.component';

View File

@ -13,7 +13,7 @@ export class AuthGuard implements CanActivate {
return true;
}
// not logged in so redirect to login page with the return url
this.router.navigate(['/login-page'], { queryParams: { returnUrl: state.url }});
this.router.navigate(['/login'], { queryParams: { returnUrl: state.url }});
return false;
}

View File

@ -21,7 +21,7 @@ export class GlobalInterceptor implements HttpInterceptor {
if (err instanceof HttpErrorResponse) {
if (err.status === 401) {
this.tokenService.logout();
this.router.navigate(['/dmps'], { queryParams: { /*returnUrl: this.state.url*/ }});
this.router.navigate(['/login'], { queryParams: { /*returnUrl: this.state.url*/ }});
}
}
});

View File

@ -6,7 +6,6 @@ import {dataModelBuilder} from '../../app/services/dataModelBuilder.service';
import { DatasetProfile } from '../entities/datasetprofile';
import {DataModel} from '../entities/DataModel';
import {Project} from '../entities/model/project';
//import {LoginComponent} from '../../app/login/login-page';
import { TokenService, TokenProvider } from './login/token.service';
import {RestBase} from './rest-base';
import 'rxjs/Rx';