diff --git a/ts/index.ts b/ts/index.ts index 812c163..9ce7101 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -80,11 +80,11 @@ export class SmartRouter { */ async _handleRouteState() { const currentLocation = window.location.pathname; - const wantedRoute = this.routes.find((routeArg) => { + const wantedRoutes = this.routes.filter((routeArg) => { return !!routeArg.matchFunction(currentLocation); }); - if (wantedRoute) { + for (const wantedRoute of wantedRoutes) { const routeResult = wantedRoute.matchFunction(currentLocation); await wantedRoute.handler(routeResult.valueOf() as IRouteInfo); }