summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/odlux/framework/src/handlers
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/odlux/framework/src/handlers')
-rw-r--r--sdnr/wt/odlux/framework/src/handlers/authenticationHandler.ts10
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