[CORD-1043] Adding click handler to display models
Change-Id: I331a193afed8e3d4f1bc5699dcb4d91a7404fa07
diff --git a/src/index.ts b/src/index.ts
index 611ae21..fa8c2ea 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -90,6 +90,7 @@
// check the user login
$transitions.onSuccess({ to: '**' }, (transtion) => {
if (!AuthService.isAuthenticated()) {
+ AuthService.clearUser();
$state.go('login');
}
});
@@ -112,8 +113,8 @@
const lastQueryString = $location.search();
// if the user is authenticated
+ $log.info(`[XOS] Is user authenticated? ${AuthService.isAuthenticated()}`);
if (AuthService.isAuthenticated()) {
- // ModelSetup.setup()
XosModelDiscoverer.discover()
.then((res) => {
if (res) {
@@ -122,7 +123,6 @@
else {
$log.info('[XOS] Failed to load some models, moving on.');
}
-
// after setting up dynamic routes, redirect to previous state
$location.path(lastRoute).search(lastQueryString);
})
@@ -130,6 +130,10 @@
$rootScope.$emit('xos.core.modelSetup');
});
}
+ else {
+ AuthService.clearUser();
+ $state.go('login');
+ }
// register keyboard shortcut
XosKeyboardShortcut.setup();