mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-03-05 03:31:04 +01:00
Merge pull request #843 from Gym/bug-previous-state
[Bug] Previous State (History)
This commit is contained in:
@@ -35,11 +35,13 @@ angular.module(ApplicationConfiguration.applicationModuleName).run(function ($ro
|
||||
|
||||
// Record previous state
|
||||
$rootScope.$on('$stateChangeSuccess', function (event, toState, toParams, fromState, fromParams) {
|
||||
$state.previous = {
|
||||
state: fromState,
|
||||
params: fromParams,
|
||||
href: $state.href(fromState, fromParams)
|
||||
};
|
||||
if (!fromState.data || !fromState.data.ignoreState) {
|
||||
$state.previous = {
|
||||
state: fromState,
|
||||
params: fromParams,
|
||||
href: $state.href(fromState, fromParams)
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -15,7 +15,10 @@ angular.module('core').config(['$stateProvider', '$urlRouterProvider',
|
||||
})
|
||||
.state('not-found', {
|
||||
url: '/not-found',
|
||||
templateUrl: 'modules/core/client/views/404.client.view.html'
|
||||
templateUrl: 'modules/core/client/views/404.client.view.html',
|
||||
data: {
|
||||
ignoreState: true
|
||||
}
|
||||
});
|
||||
}
|
||||
]);
|
||||
|
||||
@@ -38,14 +38,12 @@ angular.module('users').controller('AuthenticationController', ['$scope', '$stat
|
||||
|
||||
// OAuth provider request
|
||||
$scope.callOauthProvider = function (url) {
|
||||
var redirect_to;
|
||||
|
||||
if ($state.previous) {
|
||||
redirect_to = $state.previous.href;
|
||||
if ($state.previous && $state.previous.href) {
|
||||
url += '?redirect_to=' + encodeURIComponent($state.previous.href);
|
||||
}
|
||||
|
||||
// Effectively call OAuth authentication route:
|
||||
$window.location.href = url + (redirect_to ? '?redirect_to=' + encodeURIComponent(redirect_to) : '');
|
||||
$window.location.href = url;
|
||||
};
|
||||
}
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user