Commit 7c8e3369 authored by Lukas Burgey's avatar Lukas Burgey

Remove router

parent 43f4a021
...@@ -5,6 +5,6 @@ ...@@ -5,6 +5,6 @@
</mat-toolbar> </mat-toolbar>
<div class="outer"> <div class="outer">
<div class="inner"> <div class="inner">
<router-outlet></router-outlet> <app-mgmt></app-mgmt>
</div> </div>
</div> </div>
...@@ -33,6 +33,7 @@ import { ProfileComponent } from './profile/profile.component'; ...@@ -33,6 +33,7 @@ import { ProfileComponent } from './profile/profile.component';
import { ServiceComponent } from './service/service.component'; import { ServiceComponent } from './service/service.component';
import { SshKeysComponent } from './ssh-keys/ssh-keys.component'; import { SshKeysComponent } from './ssh-keys/ssh-keys.component';
/*
const routes = [ const routes = [
{ {
path: '', path: '',
...@@ -43,6 +44,7 @@ const routes = [ ...@@ -43,6 +44,7 @@ const routes = [
redirectTo: '/', redirectTo: '/',
}, },
]; ];
*/
@NgModule({ @NgModule({
declarations: [ declarations: [
...@@ -63,9 +65,11 @@ const routes = [ ...@@ -63,9 +65,11 @@ const routes = [
cookieName: 'csrftoken', cookieName: 'csrftoken',
headerName: 'HTTP_X_CSRFTOKEN', headerName: 'HTTP_X_CSRFTOKEN',
}), }),
/*
RouterModule.forRoot( RouterModule.forRoot(
routes, routes,
), ),
*/
MatButtonModule, MatButtonModule,
MatToolbarModule, MatToolbarModule,
MatTableModule, MatTableModule,
......
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { HttpClient, HttpErrorResponse } from '@angular/common/http'; import { HttpClient, HttpErrorResponse } from '@angular/common/http';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/map'; import 'rxjs/add/operator/map';
...@@ -65,19 +64,11 @@ export class UserService { ...@@ -65,19 +64,11 @@ export class UserService {
constructor( constructor(
public router: Router,
public activatedRoute: ActivatedRoute,
public cookieService: CookieService, public cookieService: CookieService,
public http: HttpClient, public http: HttpClient,
public snackBar: SnackBarService, public snackBar: SnackBarService,
) { ) {
this.errorStatus().subscribe( this.update();
(operational) => {
if (operational) {
this.update();
}
}
);
} }
public logState() { public logState() {
...@@ -89,19 +80,6 @@ export class UserService { ...@@ -89,19 +80,6 @@ export class UserService {
); );
} }
public errorStatus(): Observable<boolean> {
return this.activatedRoute.params.map(
(params) => {
if ('error' in params) {
this.snackBar.open('Backend error: ' + params['error']);
return false;
} else {
return true;
}
}
);
}
public backendOperational(): Observable<boolean> { public backendOperational(): Observable<boolean> {
return this.http.get('/backend/api/operational').map( return this.http.get('/backend/api/operational').map(
(data) => { (data) => {
...@@ -175,10 +153,9 @@ export class UserService { ...@@ -175,10 +153,9 @@ export class UserService {
} }
public logout() { public logout() {
this.http.get('/backend/auth_logout/').subscribe( this.http.post('/backend/auth_logout/', {}).subscribe(
data => { data => {
this.update(); this.updateData(data);
this.router.navigate(['']);
} }
); );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment