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