Skip to content
This repository was archived by the owner on Apr 15, 2019. It is now read-only.

Fix routing issues - Closes #180 #188

Merged
merged 5 commits into from
May 9, 2017
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/app/components/login/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ app.component('login', {
passphrase: this.Passphrase.normalize(_passphrase),
network: this.network,
});

this.$state.go('main');
this.$state.go(this.$rootScope.landingUrl || 'main.transactions');
}
}

Expand All @@ -78,9 +77,6 @@ app.component('login', {
const passphrase = this.$location.search().passphrase || this.$cookies.get('passphrase');
if (passphrase) {
this.input_passphrase = passphrase;
if (this.$rootScope.logged === undefined) {
this.$timeout(this.passConfirmSubmit.bind(this), 10);
}
}
}
},
Expand Down
5 changes: 1 addition & 4 deletions src/app/components/main/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@ app.component('main', {
}
});

// Return to landing page if there's any
this.activeTab = this.$rootScope.landingUrl || 'main.transactions';
this.$state.go(this.$rootScope.landingUrl || 'main.transactions');
delete this.$rootScope.landingUrl;
this.activeTab = this.$state.current.name;
}

checkIfIsDelegate() {
Expand Down
5 changes: 3 additions & 2 deletions src/app/states.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ app.config(($stateProvider, $urlRouterProvider) => {
component: 'login',
})
.state('main', {
abstract: true,
url: '/main',
component: 'main',
})
.state('main.transactions', {
url: '/transactions',
url: '',
component: 'transactions',
})
.state('main.voting', {
Expand All @@ -23,6 +24,6 @@ app.config(($stateProvider, $urlRouterProvider) => {
url: '/forging',
component: 'forging',
});
$urlRouterProvider.otherwise('/404');
$urlRouterProvider.otherwise('/');
// $locationProvider.html5Mode(true);
});
2 changes: 1 addition & 1 deletion src/test/components/login/login.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ describe('Login controller', () => {
controller.input_passphrase = testPassphrase;
const spy = sinon.spy($state, 'go');
controller.passConfirmSubmit();
expect(spy).to.have.been.calledWith('main');
expect(spy).to.have.been.calledWith();
});
});

Expand Down