From 0d26638d1dd2003b65f6c3671ce125e510066e80 Mon Sep 17 00:00:00 2001 From: Mike Fix Date: Wed, 21 Aug 2019 13:00:06 -0700 Subject: [PATCH] remove routing TODO --- lib/routing.js | 4 ++-- pages/[id].js | 2 +- pages/embed/[id].js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) 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) {