diff --git a/src/app/components/navbar/navbar.directive.js b/src/app/components/navbar/navbar.directive.js
index 29aff94..48fc683 100644
--- a/src/app/components/navbar/navbar.directive.js
+++ b/src/app/components/navbar/navbar.directive.js
@@ -21,7 +21,7 @@
return directive;
/** @ngInject */
- function NavbarController(moment, $modal, AuthService, Session, $scope, AUTH_EVENTS) {
+ function NavbarController(moment, $modal, AuthService, Session, $scope, $state, AUTH_EVENTS) {
var vm = this;
// "vm.creation" is avaible by directive option "bindToController: true"
@@ -39,17 +39,20 @@
};
vm.logout = function() {
AuthService.logout();
+ $state.go($state.current, {}, {reload: true}); //TODO move to auth
};
$scope.$on(AUTH_EVENTS.loginSuccess, function() {
if(vm.modalInstance) {
vm.modalInstance.close();
vm.modalInstance = null;
}
- vm.currentUser = Session.getCurrentUser();
+ $state.go($state.current, {}, {reload: true}); //TODO move to auth
});
$scope.$on(AUTH_EVENTS.logoutSuccess, function() {
vm.currentUser = Session.getCurrentUser();
});
+
+ if(!vm.currentUser) vm.openLogin();
}
}
diff --git a/src/app/index.route.js b/src/app/index.route.js
index 05dbc9c..f34e582 100644
--- a/src/app/index.route.js
+++ b/src/app/index.route.js
@@ -9,10 +9,10 @@
$urlRouterProvider.when('/profile/:profile', '/:profile');
$stateProvider
- .state('profile', {
- url: '/:profile',
- templateUrl: 'app/profile/profile.html',
- controller: 'ProfileController',
+ .state('main', {
+ url: '/',
+ templateUrl: 'app/main/main.html',
+ controller: 'MainController',
controllerAs: 'vm',
resolve: {
currentUser: function(AuthService) {
@@ -20,7 +20,13 @@
}
}
})
- .state('profile.page', {
+ .state('main.profile', {
+ url: ':profile',
+ templateUrl: 'app/profile/profile.html',
+ controller: 'ProfileController',
+ controllerAs: 'vm'
+ })
+ .state('main.profile.page', {
url: '/{page:.*}',
templateUrl: 'app/content-viewer/page.html',
controller: 'ContentViewerController',
diff --git a/src/app/main/main.controller.js b/src/app/main/main.controller.js
new file mode 100644
index 0000000..db15510
--- /dev/null
+++ b/src/app/main/main.controller.js
@@ -0,0 +1,13 @@
+(function() {
+ 'use strict';
+
+ angular
+ .module('angular')
+ .controller('MainController', MainController);
+
+
+ /** @ngInject */
+ function MainController() {
+
+ }
+})();
diff --git a/src/app/main/main.html b/src/app/main/main.html
new file mode 100644
index 0000000..8e2ff64
--- /dev/null
+++ b/src/app/main/main.html
@@ -0,0 +1,2 @@
+
You are using an outdated browser. Please upgrade your browser to improve your experience.
-