mirror of https://github.com/BTCPrivate/copay.git
modev wallet validation from all controllers to router
This commit is contained in:
parent
5ef607201b
commit
e5a4e3c25c
|
@ -2,12 +2,7 @@
|
|||
|
||||
angular.module('copay.backup').controller('BackupController',
|
||||
function($scope, $rootScope, $location, $window, $timeout, Socket, controllerUtils) {
|
||||
if (!$rootScope.wallet || !$rootScope.wallet.id) {
|
||||
$location.path('signin');
|
||||
}
|
||||
else {
|
||||
controllerUtils.handleTransactionByAddress($scope);
|
||||
}
|
||||
controllerUtils.handleTransactionByAddress($scope);
|
||||
|
||||
$scope.title = 'Backup';
|
||||
|
||||
|
|
|
@ -24,10 +24,6 @@ angular.module('copay.header').controller('HeaderController',
|
|||
'link': '#/backup'
|
||||
}];
|
||||
|
||||
if (!$rootScope.wallet || !$rootScope.wallet.id) {
|
||||
$location.path('signin');
|
||||
}
|
||||
|
||||
$scope.isActive = function(item) {
|
||||
if (item.link && item.link.replace('#','') == $location.path()) {
|
||||
return true;
|
||||
|
|
|
@ -28,9 +28,5 @@ angular.module('copay.home').controller('HomeController',
|
|||
$scope.selectedAddr = addr;
|
||||
};
|
||||
|
||||
|
||||
if (!$rootScope.wallet || !$rootScope.wallet.id) {
|
||||
$location.path('signin');
|
||||
}
|
||||
_updateBalance();
|
||||
});
|
||||
|
|
|
@ -7,11 +7,6 @@ angular.module('copay.peer').controller('PeerController',
|
|||
//Network.connect($rootScope.masterId);
|
||||
};
|
||||
|
||||
if (!$rootScope.wallet || !$rootScope.wallet.id) {
|
||||
$location.path('signin');
|
||||
}
|
||||
else {
|
||||
controllerUtils.handleTransactionByAddress($scope);
|
||||
}
|
||||
controllerUtils.handleTransactionByAddress($scope);
|
||||
});
|
||||
|
||||
|
|
|
@ -4,12 +4,7 @@ angular.module('copay.send').controller('SendController',
|
|||
function($scope, $rootScope, $location, Socket, controllerUtils) {
|
||||
$scope.title = 'Send';
|
||||
|
||||
if (!$rootScope.wallet || !$rootScope.wallet.id) {
|
||||
$location.path('signin');
|
||||
}
|
||||
else {
|
||||
controllerUtils.handleTransactionByAddress($scope);
|
||||
}
|
||||
controllerUtils.handleTransactionByAddress($scope);
|
||||
|
||||
$scope.sendTest = function() {
|
||||
var w = $rootScope.wallet;
|
||||
|
|
|
@ -19,6 +19,7 @@ angular.module('copay.setup').controller('SetupController',
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
updateRCSelect($scope.totalCopayers);
|
||||
|
||||
$scope.$watch('totalCopayers', function(tc) {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
'use strict';
|
||||
|
||||
|
||||
|
||||
angular.module('copay.signin').controller('SigninController',
|
||||
function($scope, $rootScope, $location, walletFactory, controllerUtils) {
|
||||
|
||||
// var peerData = Storage.get($rootScope.walletId, 'peerData');
|
||||
// $rootScope.peerId = peerData ? peerData.peerId : null;
|
||||
//
|
||||
|
||||
$scope.loading = false;
|
||||
|
||||
$scope.walletIds = walletFactory.getWalletIds();
|
||||
|
|
|
@ -34,15 +34,9 @@ angular.module('copay.transactions').controller('TransactionsController',
|
|||
$scope.txs = ts;
|
||||
};
|
||||
|
||||
|
||||
if (!$rootScope.wallet || !$rootScope.wallet.id) {
|
||||
$location.path('signin');
|
||||
}
|
||||
else {
|
||||
_updateTxs();
|
||||
var socket = Socket($scope);
|
||||
socket.on('connect', controllerUtils.handleTransactionByAddress($scope));
|
||||
}
|
||||
_updateTxs();
|
||||
var socket = Socket($scope);
|
||||
socket.on('connect', controllerUtils.handleTransactionByAddress($scope));
|
||||
|
||||
$scope.sign = function (ntxid) {
|
||||
var w = $rootScope.wallet;
|
||||
|
|
|
@ -45,4 +45,12 @@ angular
|
|||
$locationProvider
|
||||
.html5Mode(false);
|
||||
//.hashPrefix('!');
|
||||
})
|
||||
.run(function($rootScope, $location) {
|
||||
$rootScope.$on('$routeChangeStart', function() {
|
||||
if (!$rootScope.wallet || !$rootScope.wallet.id) {
|
||||
console.log('############ no wallet');
|
||||
$location.path('signin');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue