| .. | .. |
|---|
| 78 | 78 | // configure html5 to get links working on jsfiddle |
|---|
| 79 | 79 | $locationProvider.html5Mode(true); |
|---|
| 80 | 80 | $httpProvider.interceptors.push('securisHttpInterceptor'); |
|---|
| 81 | | - }); |
|---|
| 81 | + }); |
|---|
| 82 | + |
|---|
| 82 | 83 | m.controller('MainCtrl', ['$scope', '$http', '$location', '$L', '$store', |
|---|
| 83 | 84 | function($scope, $http, $location, $L, $store) { |
|---|
| 84 | 85 | |
|---|
| 86 | + $scope.currentRoute = null; |
|---|
| 87 | + console.log('Current location: ' + $location); |
|---|
| 88 | + console.log($location); |
|---|
| 85 | 89 | $location.path('/login'); |
|---|
| 86 | 90 | if ($store.get('token') != null) { |
|---|
| 87 | 91 | |
|---|
| .. | .. |
|---|
| 91 | 95 | } |
|---|
| 92 | 96 | }).success(function(data) { |
|---|
| 93 | 97 | if (data.valid) { |
|---|
| 94 | | - $http.defaults.headers.common['X-SECURIS-TOKEN'] = $store.get('token'); |
|---|
| 95 | | - $location.path('/licenses'); |
|---|
| 98 | + $http.defaults.headers.common['X-SECURIS-TOKEN'] = $store.get('token'); |
|---|
| 99 | + var location = $store.get('location') || '/licenses'; |
|---|
| 100 | + |
|---|
| 101 | + $location.path(location); |
|---|
| 96 | 102 | $store.set('user', data.user); |
|---|
| 97 | 103 | } |
|---|
| 98 | 104 | }); |
|---|