diff --git a/lib/routing.js b/lib/routing.js index 5b7b943..d99326b 100644 --- a/lib/routing.js +++ b/lib/routing.js @@ -128,8 +128,8 @@ export const getRouteState = router => { .split('/') .pop() ) - // TODO fix this hack - const parameter = path.length >= 19 && path.indexOf('.') === -1 && path + + const parameter = path.length >= 19 && path.indexOf('.') < 0 ? path : null return { parameter, diff --git a/pages/[id].js b/pages/[id].js index b465b7d..546ab24 100644 --- a/pages/[id].js +++ b/pages/[id].js @@ -10,7 +10,7 @@ class IdPage extends React.PureComponent { static contextType = ApiContext static async getInitialProps({ req, res, query }) { const path = query.id - const parameter = path && path.length >= 19 && path.indexOf('.') < 0 && path + const parameter = path.length >= 19 && path.indexOf('.') < 0 ? path : null let snippet if (parameter) { diff --git a/pages/embed/[id].js b/pages/embed/[id].js index 0a48942..8a3531d 100644 --- a/pages/embed/[id].js +++ b/pages/embed/[id].js @@ -10,7 +10,7 @@ class EmbedIdPage extends React.PureComponent { static contextType = ApiContext static async getInitialProps({ req, res, query }) { const path = query.id - const parameter = path && path.length >= 19 && path.indexOf('.') < 0 && path + const parameter = path.length >= 19 && path.indexOf('.') < 0 ? path : null let snippet if (parameter) {