Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Dspace7 Angular
Manage
Activity
Members
Labels
Plan
Issues
42
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vtechworks
Dspace7 Angular
Commits
6bd04c94
Commit
6bd04c94
authored
4 years ago
by
Giuseppe Digilio
Browse files
Options
Downloads
Patches
Plain Diff
store token on AUTHENTICATED_SUCCESS action
parent
ea26597b
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/app/core/auth/auth.effects.spec.ts
+8
-1
8 additions, 1 deletion
src/app/core/auth/auth.effects.spec.ts
src/app/core/auth/auth.effects.ts
+1
-1
1 addition, 1 deletion
src/app/core/auth/auth.effects.ts
with
9 additions
and
2 deletions
src/app/core/auth/auth.effects.spec.ts
+
8
−
1
View file @
6bd04c94
...
...
@@ -150,7 +150,8 @@ describe('AuthEffects', () => {
describe
(
'
authenticatedSuccess$
'
,
()
=>
{
it
(
'
should return a RETRIEVE_AUTHENTICATED_EPERSON action in response to a AUTHENTICATED_SUCCESS action
'
,
()
=>
{
it
(
'
should not call removeToken method
'
,
(
done
)
=>
{
spyOn
((
authEffects
as
any
).
authService
,
'
storeToken
'
);
actions
=
hot
(
'
--a-
'
,
{
a
:
{
type
:
AuthActionTypes
.
AUTHENTICATED_SUCCESS
,
payload
:
{
...
...
@@ -163,8 +164,14 @@ describe('AuthEffects', () => {
const
expected
=
cold
(
'
--b-
'
,
{
b
:
new
RetrieveAuthenticatedEpersonAction
(
EPersonMock
.
_links
.
self
.
href
)
});
authEffects
.
authenticatedSuccess$
.
subscribe
(()
=>
{
expect
(
authServiceStub
.
storeToken
).
toHaveBeenCalledWith
(
token
);
});
expect
(
authEffects
.
authenticatedSuccess$
).
toBeObservable
(
expected
);
done
();
});
});
describe
(
'
checkToken$
'
,
()
=>
{
...
...
This diff is collapsed.
Click to expand it.
src/app/core/auth/auth.effects.ts
+
1
−
1
View file @
6bd04c94
...
...
@@ -65,7 +65,6 @@ export class AuthEffects {
@
Effect
()
public
authenticateSuccess$
:
Observable
<
Action
>
=
this
.
actions$
.
pipe
(
ofType
(
AuthActionTypes
.
AUTHENTICATE_SUCCESS
),
tap
((
action
:
AuthenticationSuccessAction
)
=>
this
.
authService
.
storeToken
(
action
.
payload
)),
map
((
action
:
AuthenticationSuccessAction
)
=>
new
AuthenticatedAction
(
action
.
payload
))
);
...
...
@@ -82,6 +81,7 @@ export class AuthEffects {
@
Effect
()
public
authenticatedSuccess$
:
Observable
<
Action
>
=
this
.
actions$
.
pipe
(
ofType
(
AuthActionTypes
.
AUTHENTICATED_SUCCESS
),
tap
((
action
:
AuthenticatedSuccessAction
)
=>
this
.
authService
.
storeToken
(
action
.
payload
.
authToken
)),
map
((
action
:
AuthenticatedSuccessAction
)
=>
new
RetrieveAuthenticatedEpersonAction
(
action
.
payload
.
userHref
))
);
...
...
This diff is collapsed.
Click to expand it.
Preview
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!
Save comment
Cancel
Please
register
or
sign in
to comment