Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

Fix store routing #550

Merged
merged 3 commits into from
Jul 3, 2017
Merged
Changes from all 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
19 changes: 13 additions & 6 deletions js/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,6 @@ export default class ObRouter extends Router {
const pageState = state || 'store';
const deepRouteParts = args.filter(arg => arg !== null);

if (!state) {
this.navigate(`${guid}/store${deepRouteParts ? deepRouteParts.join('/') : ''}`, {
replace: true,
});
}

if (!this.isValidUserRoute(guid, pageState, ...deepRouteParts)) {
this.pageNotFound();
return;
Expand Down Expand Up @@ -205,6 +199,13 @@ export default class ObRouter extends Router {
// You've attempted to find a user with no particular tab. Since store is not available
// we'll take you to the home tab.
this.navigate(`${guid}/home${deepRouteParts ? deepRouteParts.join('/') : ''}`, {
replace: true, trigger: true
});
return;
}

if (!state) {
this.navigate(`${guid}/store${deepRouteParts ? deepRouteParts.join('/') : ''}`, {
replace: true,
});
}
Expand All @@ -220,6 +221,12 @@ export default class ObRouter extends Router {
if (profileFetch.statusText === 'abort' ||
profileFetch.statusText === 'abort') return;

if (!state) {
this.navigate(`${guid}/store${deepRouteParts ? deepRouteParts.join('/') : ''}`, {
replace: true,
});
}

// todo: If really not found (404), route to
// not found page, otherwise display error.
if (profileFetch.state() === 'rejected') {
Expand Down