diff options
author | Dan Timoney <dtimoney@att.com> | 2019-03-25 14:27:10 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-03-25 14:27:10 +0000 |
commit | 1f68c64e8bcf88ee485c69d36c67b0ad6590a293 (patch) | |
tree | 34ab01010c3a8b3bb4086d4b683a6fd8040f2992 /sdnr/wt/odlux/framework/src/handlers | |
parent | 528f6391de8495f3346b5e22ede404c00b9955b7 (diff) | |
parent | 2d4424c28ac35763ef44c42ae2f01664d42b268c (diff) |
Merge "Security provider for UX-Client-Login"
Diffstat (limited to 'sdnr/wt/odlux/framework/src/handlers')
-rw-r--r-- | sdnr/wt/odlux/framework/src/handlers/authenticationHandler.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sdnr/wt/odlux/framework/src/handlers/authenticationHandler.ts b/sdnr/wt/odlux/framework/src/handlers/authenticationHandler.ts index e0ae1aa8d..2abe82142 100644 --- a/sdnr/wt/odlux/framework/src/handlers/authenticationHandler.ts +++ b/sdnr/wt/odlux/framework/src/handlers/authenticationHandler.ts @@ -10,19 +10,19 @@ export interface IAuthenticationState { const initialToken = localStorage.getItem("userToken"); const authenticationStateInit: IAuthenticationState = { - user: initialToken && new User(initialToken) || undefined + user: initialToken && User.fromString(initialToken) || undefined }; export const authenticationStateHandler: IActionHandler<IAuthenticationState> = (state = authenticationStateInit, action) => { if (action instanceof UpdateAuthentication) { - - if (action.bearerToken) { - localStorage.setItem("userToken", action.bearerToken); + + const user = action.bearerToken && new User(action.bearerToken) || undefined; + if (user) { + localStorage.setItem("userToken", user.toString()); } else { localStorage.removeItem("userToken"); } - const user = action.bearerToken && new User(action.bearerToken) || undefined; state = { ...state, user |