Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
feudal
feudalWebpage
Commits
7c8e3369
Commit
7c8e3369
authored
Nov 29, 2017
by
Lukas Burgey
Browse files
Remove router
parent
43f4a021
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/app/app.component.html
View file @
7c8e3369
...
...
@@ -5,6 +5,6 @@
</mat-toolbar>
<div
class=
"outer"
>
<div
class=
"inner"
>
<
router-outlet></router-outle
t>
<
app-mgmt></app-mgm
t>
</div>
</div>
src/app/app.module.ts
View file @
7c8e3369
...
...
@@ -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
,
...
...
src/app/user.service.ts
View file @
7c8e3369
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
.
ge
t
(
'
/backend/auth_logout/
'
).
subscribe
(
this
.
http
.
pos
t
(
'
/backend/auth_logout/
'
,
{}
).
subscribe
(
data
=>
{
this
.
update
();
this
.
router
.
navigate
([
''
]);
this
.
updateData
(
data
);
}
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment