Route resolver: make _base optional.

master
Tom Hacohen 7 years ago
parent 97dc449953
commit 590e8c61a9

@ -41,17 +41,14 @@ export function getPalette(part: string): string {
export const routeResolver = new RouteResolver({ export const routeResolver = new RouteResolver({
home: '', home: '',
journals: { journals: {
_base: 'journals',
_id: { _id: {
_base: ':journalUid', _base: ':journalUid',
items: { items: {
_base: 'items',
_id: { _id: {
_base: ':itemUid', _base: ':itemUid',
}, },
}, },
entries: { entries: {
_base: 'entries',
_id: { _id: {
_base: ':entryUid', _base: ':entryUid',
}, },

@ -12,7 +12,7 @@ export class RouteResolver {
let path: string[] = []; let path: string[] = [];
name.split('.').forEach((key) => { 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); path.push(val);
dict = dict[key]; dict = dict[key];

Loading…
Cancel
Save