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

Remove router

parent 43f4a021
......@@ -5,6 +5,6 @@
</mat-toolbar>
<div class="outer">
<div class="inner">
<router-outlet></router-outlet>
<app-mgmt></app-mgmt>
</div>
</div>
......@@ -33,6 +33,7 @@ import { ProfileComponent } from './profile/profile.component';
import { ServiceComponent } from './service/service.component';
import { SshKeysComponent } from './ssh-keys/ssh-keys.component';
/*
const routes = [
{
path: '',
......@@ -43,6 +44,7 @@ const routes = [
redirectTo: '/',
},
];
*/
@NgModule({
declarations: [
......@@ -63,9 +65,11 @@ const routes = [
cookieName: 'csrftoken',
headerName: 'HTTP_X_CSRFTOKEN',
}),
/*
RouterModule.forRoot(
routes,
),
*/
MatButtonModule,
MatToolbarModule,
MatTableModule,
......
import { Injectable } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { HttpClient, HttpErrorResponse } from '@angular/common/http';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/map';
......@@ -65,19 +64,11 @@ export class UserService {
constructor(
public router: Router,
public activatedRoute: ActivatedRoute,
public cookieService: CookieService,
public http: HttpClient,
public snackBar: SnackBarService,
) {
this.errorStatus().subscribe(
(operational) => {
if (operational) {
this.update();
}
}
);
this.update();
}
public logState() {
......@@ -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> {
return this.http.get('/backend/api/operational').map(
(data) => {
......@@ -175,10 +153,9 @@ export class UserService {
}
public logout() {
this.http.get('/backend/auth_logout/').subscribe(
this.http.post('/backend/auth_logout/', {}).subscribe(
data => {
this.update();
this.router.navigate(['']);
this.updateData(data);
}
);
}
......
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