accelerator-core
Version:
[](https://travis-ci.org/furkleindustries/accelerator-core)
36 lines (33 loc) • 633 B
text/typescript
import {
ILinkNavigationProps,
} from './ILinkNavigationProps';
import {
navigate,
} from '../../state/navigate';
import {
assert,
} from 'ts-assertions';
export const strings = {
PASSAGE_DOES_NOT_EXIST:
'The passageName argument, %name%, does not match any passages within ' +
'the passages map.',
};
export function doLinkNavigation({
dispatch,
passage,
passageName,
tags: linkTags,
}: ILinkNavigationProps) {
assert(
passage,
strings.PASSAGE_DOES_NOT_EXIST.replace(
/%name%/gi,
passageName || '(No name)',
),
);
navigate({
dispatch,
passage,
linkTags,
});
}