From 3aa7b181c95a1a75e62d51573bd3fab9ecb12a8f Mon Sep 17 00:00:00 2001 From: Peter Kaske Date: Tue, 14 Jun 2022 15:04:08 +0200 Subject: [PATCH] Fix route params. --- tp-router.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tp-router.js b/tp-router.js index 1f06db8..bb978b9 100644 --- a/tp-router.js +++ b/tp-router.js @@ -183,9 +183,13 @@ export class TpRouter extends LitElement { this.routes[namespace] = {}; } + const keys = []; + const r = pathToRegexp(path, keys); + r.keys = keys; + this.routes[namespace][path] = { path: path, - regex: pathToRegexp(path), + regex: r, data: data, redirect: redirect, params: {}