1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 07:43:35 +00:00

tracking vault state with stateService

This commit is contained in:
Kyle Spearrin
2016-12-08 00:56:38 -05:00
parent ced707647f
commit e414dd1867
9 changed files with 80 additions and 75 deletions

View File

@@ -75,7 +75,7 @@
url: '/vault',
templateUrl: 'app/vault/views/vault.html',
controller: 'vaultController',
params: { scrollY: 0, searchText: null, syncOnLoad: false }
params: { syncOnLoad: false }
})
.state('tabs.settings', {
url: '/settings',
@@ -93,24 +93,21 @@
templateUrl: 'app/vault/views/vaultViewFolder.html',
controller: 'vaultViewFolderController',
data: { authorize: true },
params: { animation: null, returnScrollY: 0, returnSearchText: null, from: 'vault' }
params: { animation: null, from: 'vault' }
})
.state('viewSite', {
url: '/view-site?siteId',
templateUrl: 'app/vault/views/vaultViewSite.html',
controller: 'vaultViewSiteController',
data: { authorize: true },
params: { animation: null, returnScrollY: 0, returnSearchText: null, from: 'vault' }
params: { animation: null, from: 'vault' }
})
.state('addSite', {
url: '/add-site',
templateUrl: 'app/vault/views/vaultAddSite.html',
controller: 'vaultAddSiteController',
data: { authorize: true },
params: {
animation: null, returnScrollY: 0, returnSearchText: null, name: null,
uri: null, site: null, from: 'vault'
}
params: { animation: null, name: null, uri: null, site: null, from: 'vault' }
})
.state('editSite', {
url: '/edit-site?siteId',
@@ -189,8 +186,12 @@
params: { animation: null }
});
})
.run(function ($rootScope, userService, loginService, cryptoService, tokenService, $state, constantsService) {
.run(function ($rootScope, userService, loginService, cryptoService, tokenService, $state, constantsService, stateService) {
$rootScope.$on('$stateChangeStart', function (event, toState, toParams) {
if ($state.current.name.indexOf('tabs.') > -1 && toState.name.indexOf('tabs.') > -1) {
stateService.purgeState();
}
cryptoService.getKey(false, function (key) {
tokenService.getToken(function (token) {
userService.isAuthenticated(function (isAuthenticated) {