Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
arsnova-click-v2-frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
ARSnova
arsnova-click-v2-frontend
Commits
2f2c2ae0
Commit
2f2c2ae0
authored
Nov 17, 2019
by
Christopher Fullarton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Will unsubscribe the storageservice subscription if a new user is logged in
parent
df49e3fd
Pipeline
#33607
failed with stages
in 3 minutes and 59 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
9 deletions
+12
-9
user.service.ts
src/app/service/user/user.service.ts
+12
-9
No files found.
src/app/service/user/user.service.ts
View file @
2f2c2ae0
import
{
isPlatformBrowser
,
isPlatformServer
}
from
'
@angular/common
'
;
import
{
Inject
,
Injectable
,
PLATFORM_ID
}
from
'
@angular/core
'
;
import
{
JwtHelperService
}
from
'
@auth0/angular-jwt
'
;
import
{
ReplaySubject
}
from
'
rxjs
'
;
import
{
filter
}
from
'
rxjs/operators
'
;
import
{
ReplaySubject
,
Subject
}
from
'
rxjs
'
;
import
{
filter
,
takeUntil
}
from
'
rxjs/operators
'
;
import
{
QuizEntity
}
from
'
../../lib/entities/QuizEntity
'
;
import
{
DbState
,
StorageKey
}
from
'
../../lib/enums/enums
'
;
import
{
StatusProtocol
}
from
'
../../lib/enums/Message
'
;
...
...
@@ -16,12 +16,6 @@ import { StorageService } from '../storage/storage.service';
providedIn
:
'
root
'
,
})
export
class
UserService
{
private
_isLoggedIn
:
boolean
;
get
isLoggedIn
():
boolean
{
return
this
.
_isLoggedIn
;
}
set
isLoggedIn
(
value
:
boolean
)
{
if
(
!
value
)
{
this
.
_casTicket
=
null
;
...
...
@@ -36,7 +30,8 @@ export class UserService {
}
if
(
isPlatformBrowser
(
this
.
platformId
))
{
console
.
log
(
`UserService: switching db to user
${
this
.
username
}
- isLoggedIn:
${
value
}
`
);
this
.
storageService
.
switchDb
(
this
.
_username
).
subscribe
(()
=>
{
this
.
_destroy
.
next
();
this
.
storageService
.
switchDb
(
this
.
_username
).
pipe
(
takeUntil
(
this
.
_destroy
)).
subscribe
(()
=>
{
this
.
_isLoggedIn
=
value
;
this
.
_loginNotifier
.
next
(
value
);
});
...
...
@@ -46,6 +41,14 @@ export class UserService {
}
}
private
_isLoggedIn
:
boolean
;
get
isLoggedIn
():
boolean
{
return
this
.
_isLoggedIn
;
}
private
readonly
_destroy
=
new
Subject
();
private
_staticLoginTokenContent
:
ILoginSerialized
;
get
staticLoginTokenContent
():
ILoginSerialized
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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