aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/odlux/framework/src/handlers/authenticationHandler.ts
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/odlux/framework/src/handlers/authenticationHandler.ts')
-rw-r--r--sdnr/wt/odlux/framework/src/handlers/authenticationHandler.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/sdnr/wt/odlux/framework/src/handlers/authenticationHandler.ts b/sdnr/wt/odlux/framework/src/handlers/authenticationHandler.ts
index 2abe82142..a159cb627 100644
--- a/sdnr/wt/odlux/framework/src/handlers/authenticationHandler.ts
+++ b/sdnr/wt/odlux/framework/src/handlers/authenticationHandler.ts
@@ -3,6 +3,8 @@ import { UpdateAuthentication } from '../actions/authentication';
import { User } from '../models/authentication';
+import { onLogin, onLogout } from '../services/applicationApi';
+
export interface IAuthenticationState {
user?: User;
}
@@ -19,8 +21,10 @@ export const authenticationStateHandler: IActionHandler<IAuthenticationState> =
const user = action.bearerToken && new User(action.bearerToken) || undefined;
if (user) {
localStorage.setItem("userToken", user.toString());
+ onLogin();
} else {
localStorage.removeItem("userToken");
+ onLogout();
}
state = {