2019-01-24 20:15:10 +00:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
2018-11-27 10:51:33 +00:00
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
2018-11-05 15:26:18 +00:00
|
|
|
import Vue from 'vue';
|
2019-09-09 11:33:39 +01:00
|
|
|
import Router, { RouteRecord } from 'vue-router';
|
|
|
|
|
2020-11-11 16:41:46 +00:00
|
|
|
import AccessGrants from '@/components/accessGrants/AccessGrants.vue';
|
2020-11-16 20:46:12 +00:00
|
|
|
import CreateAccessGrant from '@/components/accessGrants/CreateAccessGrant.vue';
|
2020-11-17 16:01:05 +00:00
|
|
|
import CLIStep from '@/components/accessGrants/steps/CLIStep.vue';
|
2020-11-18 15:20:29 +00:00
|
|
|
import CreatePassphraseStep from '@/components/accessGrants/steps/CreatePassphraseStep.vue';
|
|
|
|
import EnterPassphraseStep from '@/components/accessGrants/steps/EnterPassphraseStep.vue';
|
2020-11-16 20:46:12 +00:00
|
|
|
import NameStep from '@/components/accessGrants/steps/NameStep.vue';
|
|
|
|
import PermissionsStep from '@/components/accessGrants/steps/PermissionsStep.vue';
|
2020-11-16 21:15:53 +00:00
|
|
|
import ResultStep from '@/components/accessGrants/steps/ResultStep.vue';
|
2020-11-16 20:46:12 +00:00
|
|
|
import UploadStep from '@/components/accessGrants/steps/UploadStep.vue';
|
2019-01-09 15:40:21 +00:00
|
|
|
import AccountArea from '@/components/account/AccountArea.vue';
|
2019-09-09 11:33:39 +01:00
|
|
|
import AccountBilling from '@/components/account/billing/BillingArea.vue';
|
2020-05-21 18:01:56 +01:00
|
|
|
import DetailedHistory from '@/components/account/billing/depositAndBillingHistory/DetailedHistory.vue';
|
2020-06-10 12:42:44 +01:00
|
|
|
import CreditsHistory from '@/components/account/billing/freeCredits/CreditsHistory.vue';
|
2020-03-16 12:08:38 +00:00
|
|
|
import SettingsArea from '@/components/account/SettingsArea.vue';
|
2019-08-19 12:20:38 +01:00
|
|
|
import Page404 from '@/components/errors/Page404.vue';
|
2020-04-22 17:21:12 +01:00
|
|
|
import OnboardingTourArea from '@/components/onboardingTour/OnboardingTourArea.vue';
|
2020-12-01 13:17:32 +00:00
|
|
|
import AddPaymentStep from '@/components/onboardingTour/steps/AddPaymentStep.vue';
|
|
|
|
import CreateAccessGrantStep from '@/components/onboardingTour/steps/CreateAccessGrantStep.vue';
|
|
|
|
import OverviewStep from '@/components/onboardingTour/steps/OverviewStep.vue';
|
2020-08-31 12:54:40 +01:00
|
|
|
import CreateProject from '@/components/project/CreateProject.vue';
|
2020-09-15 13:44:23 +01:00
|
|
|
import EditProjectDetails from '@/components/project/EditProjectDetails.vue';
|
2020-03-16 12:08:38 +00:00
|
|
|
import ProjectDashboard from '@/components/project/ProjectDashboard.vue';
|
2019-09-09 11:33:39 +01:00
|
|
|
import ProjectMembersArea from '@/components/team/ProjectMembersArea.vue';
|
|
|
|
|
2019-11-06 12:27:26 +00:00
|
|
|
import store from '@/store';
|
2019-08-22 11:44:08 +01:00
|
|
|
import { NavigationLink } from '@/types/navigation';
|
2019-11-05 10:32:34 +00:00
|
|
|
const DashboardArea = () => import('@/views/DashboardArea.vue');
|
|
|
|
const ForgotPassword = () => import('@/views/forgotPassword/ForgotPassword.vue');
|
|
|
|
const LoginArea = () => import('@/views/login/LoginArea.vue');
|
|
|
|
const RegisterArea = () => import('@/views/register/RegisterArea.vue');
|
2018-11-05 15:26:18 +00:00
|
|
|
|
|
|
|
Vue.use(Router);
|
|
|
|
|
2019-09-27 15:41:04 +01:00
|
|
|
/**
|
|
|
|
* RouteConfig contains information about all routes and subroutes
|
|
|
|
*/
|
2019-08-22 11:44:08 +01:00
|
|
|
export abstract class RouteConfig {
|
|
|
|
// root paths
|
|
|
|
public static Root = new NavigationLink('/', 'Root');
|
|
|
|
public static Login = new NavigationLink('/login', 'Login');
|
2020-05-29 16:36:59 +01:00
|
|
|
public static Register = new NavigationLink('/signup', 'Register');
|
2019-08-22 11:44:08 +01:00
|
|
|
public static ForgotPassword = new NavigationLink('/forgot-password', 'Forgot Password');
|
|
|
|
public static Account = new NavigationLink('/account', 'Account');
|
2020-03-16 12:08:38 +00:00
|
|
|
public static ProjectDashboard = new NavigationLink('/project-dashboard', 'Dashboard');
|
2020-09-09 19:25:59 +01:00
|
|
|
public static Users = new NavigationLink('/project-members', 'Users');
|
2020-04-22 17:21:12 +01:00
|
|
|
public static OnboardingTour = new NavigationLink('/onboarding-tour', 'Onboarding Tour');
|
2020-08-31 12:54:40 +01:00
|
|
|
public static CreateProject = new NavigationLink('/create-project', 'Create Project');
|
2020-09-15 13:44:23 +01:00
|
|
|
public static EditProjectDetails = new NavigationLink('/edit-project-details', 'Edit Project Details');
|
2020-11-11 16:41:46 +00:00
|
|
|
public static AccessGrants = new NavigationLink('/access-grants', 'Access Grants');
|
2019-08-22 11:44:08 +01:00
|
|
|
|
2020-12-01 13:17:32 +00:00
|
|
|
// account child paths
|
2020-03-16 12:08:38 +00:00
|
|
|
public static Settings = new NavigationLink('settings', 'Settings');
|
2019-09-04 15:33:26 +01:00
|
|
|
public static Billing = new NavigationLink('billing', 'Billing');
|
2019-09-11 11:21:45 +01:00
|
|
|
public static BillingHistory = new NavigationLink('billing-history', 'Billing History');
|
2020-05-21 18:01:56 +01:00
|
|
|
public static DepositHistory = new NavigationLink('deposit-history', 'Deposit History');
|
2020-06-10 12:42:44 +01:00
|
|
|
public static CreditsHistory = new NavigationLink('credits-history', 'Credits History');
|
2020-12-01 13:17:32 +00:00
|
|
|
|
|
|
|
// access grant child paths
|
2020-11-16 20:46:12 +00:00
|
|
|
public static CreateAccessGrant = new NavigationLink('create-grant', 'Create Access Grant');
|
|
|
|
public static NameStep = new NavigationLink('name', 'Name Access Grant');
|
|
|
|
public static PermissionsStep = new NavigationLink('permissions', 'Access Grant Permissions');
|
2020-11-18 15:20:29 +00:00
|
|
|
public static CreatePassphraseStep = new NavigationLink('create-passphrase', 'Access Grant Create Passphrase');
|
|
|
|
public static EnterPassphraseStep = new NavigationLink('enter-passphrase', 'Access Grant Enter Passphrase');
|
2020-11-16 21:15:53 +00:00
|
|
|
public static ResultStep = new NavigationLink('result', 'Access Grant Result');
|
2020-11-17 16:01:05 +00:00
|
|
|
public static CLIStep = new NavigationLink('cli', 'Access Grant In CLI');
|
2020-11-16 20:46:12 +00:00
|
|
|
public static UploadStep = new NavigationLink('upload', 'Access Grant Upload Data');
|
2020-11-11 16:41:46 +00:00
|
|
|
|
2020-12-01 13:17:32 +00:00
|
|
|
// onboarding tour child paths
|
|
|
|
public static OverviewStep = new NavigationLink('overview', 'Onboarding Overview');
|
|
|
|
public static PaymentStep = new NavigationLink('payment', 'Onboarding Payment');
|
|
|
|
public static AccessGrant = new NavigationLink('access', 'Onboarding Access Grant');
|
2020-12-01 16:53:57 +00:00
|
|
|
public static AccessGrantName = new NavigationLink('name', 'Onboarding Name Access Grant');
|
|
|
|
public static AccessGrantPermissions = new NavigationLink('permissions', 'Onboarding Access Grant Permissions');
|
|
|
|
public static AccessGrantPassphrase = new NavigationLink('create-passphrase', 'Onboarding Access Grant Create Passphrase');
|
|
|
|
public static AccessGrantResult = new NavigationLink('result', 'Onboarding Access Grant Result');
|
2020-12-01 13:17:32 +00:00
|
|
|
|
2020-01-22 11:16:27 +00:00
|
|
|
// TODO: disabled until implementation
|
|
|
|
// public static Referral = new NavigationLink('referral', 'Referral');
|
2019-08-22 11:44:08 +01:00
|
|
|
|
|
|
|
// not in project yet
|
|
|
|
// public static Referral = new NavigationLink('//ref/:ids', 'Referral');
|
|
|
|
}
|
|
|
|
|
2019-11-06 12:27:26 +00:00
|
|
|
export const notProjectRelatedRoutes = [
|
|
|
|
RouteConfig.Login.name,
|
|
|
|
RouteConfig.Register.name,
|
2020-03-17 11:44:47 +00:00
|
|
|
RouteConfig.ForgotPassword.name,
|
2019-11-06 12:27:26 +00:00
|
|
|
RouteConfig.Billing.name,
|
|
|
|
RouteConfig.BillingHistory.name,
|
2020-05-21 18:01:56 +01:00
|
|
|
RouteConfig.DepositHistory.name,
|
2020-06-10 12:42:44 +01:00
|
|
|
RouteConfig.CreditsHistory.name,
|
2020-03-16 12:08:38 +00:00
|
|
|
RouteConfig.Settings.name,
|
2020-11-11 16:41:46 +00:00
|
|
|
RouteConfig.AccessGrants.name,
|
2020-01-22 11:16:27 +00:00
|
|
|
// RouteConfig.Referral.name,
|
2019-11-06 12:27:26 +00:00
|
|
|
];
|
|
|
|
|
2019-10-28 13:27:12 +00:00
|
|
|
export const router = new Router({
|
2019-02-20 13:33:56 +00:00
|
|
|
mode: 'history',
|
|
|
|
routes: [
|
|
|
|
{
|
2019-08-22 11:44:08 +01:00
|
|
|
path: RouteConfig.Login.path,
|
|
|
|
name: RouteConfig.Login.name,
|
2019-09-26 14:36:12 +01:00
|
|
|
component: LoginArea,
|
2019-02-20 13:33:56 +00:00
|
|
|
},
|
|
|
|
{
|
2019-08-22 11:44:08 +01:00
|
|
|
path: RouteConfig.Register.path,
|
|
|
|
name: RouteConfig.Register.name,
|
2019-09-26 14:36:12 +01:00
|
|
|
component: RegisterArea,
|
2019-07-19 19:22:10 +01:00
|
|
|
},
|
2019-04-02 14:38:57 +01:00
|
|
|
{
|
2019-08-22 11:44:08 +01:00
|
|
|
path: RouteConfig.ForgotPassword.path,
|
|
|
|
name: RouteConfig.ForgotPassword.name,
|
2019-09-13 15:58:18 +01:00
|
|
|
component: ForgotPassword,
|
2019-04-02 14:38:57 +01:00
|
|
|
},
|
2019-02-20 13:33:56 +00:00
|
|
|
{
|
2019-08-22 11:44:08 +01:00
|
|
|
path: RouteConfig.Root.path,
|
2019-02-20 13:33:56 +00:00
|
|
|
meta: {
|
2019-09-13 15:58:18 +01:00
|
|
|
requiresAuth: true,
|
2019-02-20 13:33:56 +00:00
|
|
|
},
|
2019-09-26 14:36:12 +01:00
|
|
|
component: DashboardArea,
|
2019-02-20 13:33:56 +00:00
|
|
|
children: [
|
|
|
|
{
|
2019-08-22 11:44:08 +01:00
|
|
|
path: RouteConfig.Account.path,
|
|
|
|
name: RouteConfig.Account.name,
|
2019-06-03 13:19:48 +01:00
|
|
|
component: AccountArea,
|
|
|
|
children: [
|
|
|
|
{
|
2020-03-16 12:08:38 +00:00
|
|
|
path: RouteConfig.Settings.path,
|
|
|
|
name: RouteConfig.Settings.name,
|
|
|
|
component: SettingsArea,
|
2019-06-03 13:19:48 +01:00
|
|
|
},
|
2019-09-04 15:33:26 +01:00
|
|
|
{
|
|
|
|
path: RouteConfig.Billing.path,
|
|
|
|
name: RouteConfig.Billing.name,
|
|
|
|
component: AccountBilling,
|
|
|
|
},
|
2019-09-11 11:21:45 +01:00
|
|
|
{
|
|
|
|
path: RouteConfig.BillingHistory.path,
|
|
|
|
name: RouteConfig.BillingHistory.name,
|
2020-05-21 18:01:56 +01:00
|
|
|
component: DetailedHistory,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: RouteConfig.DepositHistory.path,
|
|
|
|
name: RouteConfig.DepositHistory.name,
|
|
|
|
component: DetailedHistory,
|
2019-09-11 11:21:45 +01:00
|
|
|
},
|
2020-06-10 12:42:44 +01:00
|
|
|
{
|
|
|
|
path: RouteConfig.CreditsHistory.path,
|
|
|
|
name: RouteConfig.CreditsHistory.name,
|
|
|
|
component: CreditsHistory,
|
|
|
|
},
|
2020-01-22 11:16:27 +00:00
|
|
|
// {
|
|
|
|
// path: RouteConfig.Referral.path,
|
|
|
|
// name: RouteConfig.Referral.name,
|
|
|
|
// component: ReferralArea,
|
|
|
|
// },
|
2019-09-13 15:58:18 +01:00
|
|
|
],
|
2019-02-20 13:33:56 +00:00
|
|
|
},
|
|
|
|
{
|
2020-03-16 12:08:38 +00:00
|
|
|
path: RouteConfig.ProjectDashboard.path,
|
|
|
|
name: RouteConfig.ProjectDashboard.name,
|
|
|
|
component: ProjectDashboard,
|
2019-04-05 16:08:14 +01:00
|
|
|
},
|
|
|
|
{
|
2019-08-22 11:44:08 +01:00
|
|
|
path: RouteConfig.Root.path,
|
2019-04-05 16:08:14 +01:00
|
|
|
name: 'default',
|
2020-03-16 12:08:38 +00:00
|
|
|
component: ProjectDashboard,
|
2019-02-20 13:33:56 +00:00
|
|
|
},
|
|
|
|
{
|
2020-09-09 19:25:59 +01:00
|
|
|
path: RouteConfig.Users.path,
|
|
|
|
name: RouteConfig.Users.name,
|
2019-09-13 15:58:18 +01:00
|
|
|
component: ProjectMembersArea,
|
2019-02-20 13:33:56 +00:00
|
|
|
},
|
2020-02-18 15:48:19 +00:00
|
|
|
{
|
2020-04-22 17:21:12 +01:00
|
|
|
path: RouteConfig.OnboardingTour.path,
|
|
|
|
name: RouteConfig.OnboardingTour.name,
|
|
|
|
component: OnboardingTourArea,
|
2020-12-01 13:17:32 +00:00
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: RouteConfig.OverviewStep.path,
|
|
|
|
name: RouteConfig.OverviewStep.name,
|
|
|
|
component: OverviewStep,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: RouteConfig.PaymentStep.path,
|
|
|
|
name: RouteConfig.PaymentStep.name,
|
|
|
|
component: AddPaymentStep,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: RouteConfig.AccessGrant.path,
|
|
|
|
name: RouteConfig.AccessGrant.name,
|
|
|
|
component: CreateAccessGrantStep,
|
|
|
|
children: [
|
|
|
|
{
|
2020-12-01 16:53:57 +00:00
|
|
|
path: RouteConfig.AccessGrantName.path,
|
|
|
|
name: RouteConfig.AccessGrantName.name,
|
2020-12-01 13:17:32 +00:00
|
|
|
component: NameStep,
|
|
|
|
},
|
|
|
|
{
|
2020-12-01 16:53:57 +00:00
|
|
|
path: RouteConfig.AccessGrantPermissions.path,
|
|
|
|
name: RouteConfig.AccessGrantPermissions.name,
|
2020-12-01 13:17:32 +00:00
|
|
|
component: PermissionsStep,
|
|
|
|
props: true,
|
|
|
|
},
|
|
|
|
{
|
2020-12-01 16:53:57 +00:00
|
|
|
path: RouteConfig.AccessGrantPassphrase.path,
|
|
|
|
name: RouteConfig.AccessGrantPassphrase.name,
|
2020-12-01 13:17:32 +00:00
|
|
|
component: CreatePassphraseStep,
|
|
|
|
},
|
|
|
|
{
|
2020-12-01 16:53:57 +00:00
|
|
|
path: RouteConfig.AccessGrantResult.path,
|
|
|
|
name: RouteConfig.AccessGrantResult.name,
|
2020-12-01 13:17:32 +00:00
|
|
|
component: ResultStep,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
2020-02-18 15:48:19 +00:00
|
|
|
},
|
2020-08-31 12:54:40 +01:00
|
|
|
{
|
|
|
|
path: RouteConfig.CreateProject.path,
|
|
|
|
name: RouteConfig.CreateProject.name,
|
|
|
|
component: CreateProject,
|
|
|
|
},
|
2020-09-15 13:44:23 +01:00
|
|
|
{
|
|
|
|
path: RouteConfig.EditProjectDetails.path,
|
|
|
|
name: RouteConfig.EditProjectDetails.name,
|
|
|
|
component: EditProjectDetails,
|
|
|
|
},
|
2020-11-11 16:41:46 +00:00
|
|
|
{
|
|
|
|
path: RouteConfig.AccessGrants.path,
|
|
|
|
name: RouteConfig.AccessGrants.name,
|
|
|
|
component: AccessGrants,
|
|
|
|
children: [
|
|
|
|
{
|
2020-11-16 20:46:12 +00:00
|
|
|
path: RouteConfig.CreateAccessGrant.path,
|
|
|
|
name: RouteConfig.CreateAccessGrant.name,
|
|
|
|
component: CreateAccessGrant,
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: RouteConfig.NameStep.path,
|
|
|
|
name: RouteConfig.NameStep.name,
|
|
|
|
component: NameStep,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: RouteConfig.PermissionsStep.path,
|
|
|
|
name: RouteConfig.PermissionsStep.name,
|
|
|
|
component: PermissionsStep,
|
2020-11-16 21:59:01 +00:00
|
|
|
props: true,
|
2020-11-16 20:46:12 +00:00
|
|
|
},
|
|
|
|
{
|
2020-11-18 15:20:29 +00:00
|
|
|
path: RouteConfig.CreatePassphraseStep.path,
|
|
|
|
name: RouteConfig.CreatePassphraseStep.name,
|
|
|
|
component: CreatePassphraseStep,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: RouteConfig.EnterPassphraseStep.path,
|
|
|
|
name: RouteConfig.EnterPassphraseStep.name,
|
|
|
|
component: EnterPassphraseStep,
|
2020-11-16 20:46:12 +00:00
|
|
|
},
|
2020-11-16 21:15:53 +00:00
|
|
|
{
|
|
|
|
path: RouteConfig.ResultStep.path,
|
|
|
|
name: RouteConfig.ResultStep.name,
|
|
|
|
component: ResultStep,
|
|
|
|
},
|
2020-11-17 16:01:05 +00:00
|
|
|
{
|
|
|
|
path: RouteConfig.CLIStep.path,
|
|
|
|
name: RouteConfig.CLIStep.name,
|
|
|
|
component: CLIStep,
|
|
|
|
},
|
2020-11-16 20:46:12 +00:00
|
|
|
{
|
|
|
|
path: RouteConfig.UploadStep.path,
|
|
|
|
name: RouteConfig.UploadStep.name,
|
|
|
|
component: UploadStep,
|
|
|
|
},
|
|
|
|
],
|
2020-11-11 16:41:46 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2019-02-20 13:33:56 +00:00
|
|
|
{
|
|
|
|
path: '*',
|
|
|
|
name: '404',
|
2019-09-13 15:58:18 +01:00
|
|
|
component: Page404,
|
2019-03-14 12:48:43 +00:00
|
|
|
},
|
2019-09-13 15:58:18 +01:00
|
|
|
],
|
2018-11-05 15:26:18 +00:00
|
|
|
});
|
2018-11-28 09:16:35 +00:00
|
|
|
|
|
|
|
router.beforeEach((to, from, next) => {
|
2019-09-27 15:41:04 +01:00
|
|
|
if (navigateToDefaultSubTab(to.matched, RouteConfig.Account)) {
|
2020-03-18 17:07:29 +00:00
|
|
|
next(RouteConfig.Account.with(RouteConfig.Billing).path);
|
2018-11-28 09:16:35 +00:00
|
|
|
|
2019-08-22 11:44:08 +01:00
|
|
|
return;
|
|
|
|
}
|
2019-04-05 16:08:14 +01:00
|
|
|
|
2020-11-16 20:46:12 +00:00
|
|
|
if (navigateToDefaultSubTab(to.matched, RouteConfig.AccessGrants.with(RouteConfig.CreateAccessGrant))) {
|
|
|
|
next(RouteConfig.AccessGrants.with(RouteConfig.CreateAccessGrant).with(RouteConfig.NameStep).path);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-12-06 22:19:38 +00:00
|
|
|
if (navigateToDefaultSubTab(to.matched, RouteConfig.OnboardingTour.with(RouteConfig.AccessGrant))) {
|
|
|
|
next(RouteConfig.OnboardingTour.with(RouteConfig.AccessGrant).with(RouteConfig.NameStep).path);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-12-01 13:17:32 +00:00
|
|
|
if (navigateToDefaultSubTab(to.matched, RouteConfig.OnboardingTour)) {
|
|
|
|
next(RouteConfig.OnboardingTour.with(RouteConfig.OverviewStep).path);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-08-28 14:08:19 +01:00
|
|
|
if (to.name === 'default') {
|
2020-03-18 17:07:29 +00:00
|
|
|
next(RouteConfig.ProjectDashboard.path);
|
2019-09-27 15:41:04 +01:00
|
|
|
|
|
|
|
return;
|
2019-08-28 14:08:19 +01:00
|
|
|
}
|
|
|
|
|
2019-08-22 11:44:08 +01:00
|
|
|
next();
|
|
|
|
});
|
2019-04-05 16:08:14 +01:00
|
|
|
|
2019-11-06 12:27:26 +00:00
|
|
|
router.afterEach(({name}, from) => {
|
|
|
|
if (!name) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (notProjectRelatedRoutes.includes(name)) {
|
|
|
|
document.title = `${router.currentRoute.name} | ${store.state.appStateModule.satelliteName}`;
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const selectedProjectName = store.state.projectsModule.selectedProject.name ?
|
|
|
|
`${store.state.projectsModule.selectedProject.name} | ` : '';
|
|
|
|
|
|
|
|
document.title = `${selectedProjectName + router.currentRoute.name} | ${store.state.appStateModule.satelliteName}`;
|
|
|
|
});
|
|
|
|
|
2019-08-22 11:44:08 +01:00
|
|
|
/**
|
|
|
|
* if our route is a tab and has no sub tab route - we will navigate to default subtab.
|
2020-03-18 17:07:29 +00:00
|
|
|
* F.E. /account/ -> /account/billing/;
|
2019-08-22 11:44:08 +01:00
|
|
|
* @param routes - array of RouteRecord from vue-router
|
|
|
|
* @param next - callback to process next route
|
|
|
|
* @param tabRoute - tabNavigator route
|
|
|
|
*/
|
2019-09-27 15:41:04 +01:00
|
|
|
function navigateToDefaultSubTab(routes: RouteRecord[], tabRoute: NavigationLink): boolean {
|
2020-11-16 20:46:12 +00:00
|
|
|
return (routes.length === 2 && (routes[1].name as string) === tabRoute.name) ||
|
|
|
|
(routes.length === 3 && (routes[2].name as string) === tabRoute.name);
|
2019-04-05 16:08:14 +01:00
|
|
|
}
|