forked from jsnbuchanan/crowd-funder-for-time-pwa
remove unused redirect to start page (now that we're creating an ID up front)
This commit is contained in:
@@ -2,35 +2,11 @@ import {
|
|||||||
createRouter,
|
createRouter,
|
||||||
createWebHistory,
|
createWebHistory,
|
||||||
createMemoryHistory,
|
createMemoryHistory,
|
||||||
NavigationGuardNext,
|
|
||||||
RouteLocationNormalized,
|
RouteLocationNormalized,
|
||||||
RouteRecordRaw,
|
RouteRecordRaw,
|
||||||
} from "vue-router";
|
} from "vue-router";
|
||||||
import { accountsDBPromise } from "../db/index";
|
|
||||||
import { logger } from "../utils/logger";
|
import { logger } from "../utils/logger";
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param to :RouteLocationNormalized
|
|
||||||
* @param from :RouteLocationNormalized
|
|
||||||
* @param next :NavigationGuardNext
|
|
||||||
*/
|
|
||||||
const enterOrStart = async (
|
|
||||||
to: RouteLocationNormalized,
|
|
||||||
from: RouteLocationNormalized,
|
|
||||||
next: NavigationGuardNext,
|
|
||||||
) => {
|
|
||||||
// one of the few times we use accountsDBPromise directly; try to avoid more usage
|
|
||||||
const accountsDB = await accountsDBPromise;
|
|
||||||
const num_accounts = await accountsDB.accounts.count();
|
|
||||||
|
|
||||||
if (num_accounts > 0) {
|
|
||||||
next();
|
|
||||||
} else {
|
|
||||||
next({ name: "start" });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const routes: Array<RouteRecordRaw> = [
|
const routes: Array<RouteRecordRaw> = [
|
||||||
{
|
{
|
||||||
path: "/account",
|
path: "/account",
|
||||||
@@ -216,7 +192,6 @@ const routes: Array<RouteRecordRaw> = [
|
|||||||
path: "/projects",
|
path: "/projects",
|
||||||
name: "projects",
|
name: "projects",
|
||||||
component: () => import("../views/ProjectsView.vue"),
|
component: () => import("../views/ProjectsView.vue"),
|
||||||
beforeEnter: enterOrStart,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/quick-action-bvc",
|
path: "/quick-action-bvc",
|
||||||
|
|||||||
Reference in New Issue
Block a user