From 590e8c61a9cf88b54bb81fb0c008de548c468f27 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Thu, 7 Dec 2017 20:46:26 +0000 Subject: [PATCH] Route resolver: make _base optional. --- src/App.tsx | 3 --- src/routes.tsx | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index c13ab17..7f30552 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -41,17 +41,14 @@ export function getPalette(part: string): string { export const routeResolver = new RouteResolver({ home: '', journals: { - _base: 'journals', _id: { _base: ':journalUid', items: { - _base: 'items', _id: { _base: ':itemUid', }, }, entries: { - _base: 'entries', _id: { _base: ':entryUid', }, diff --git a/src/routes.tsx b/src/routes.tsx index c27093a..0154acd 100644 --- a/src/routes.tsx +++ b/src/routes.tsx @@ -12,7 +12,7 @@ export class RouteResolver { let path: string[] = []; name.split('.').forEach((key) => { - const val = (typeof dict[key] === 'string') ? dict[key] : dict[key]._base; + const val = (typeof dict[key] === 'string') ? dict[key] : (dict[key]._base) ? dict[key]._base : key; path.push(val); dict = dict[key];