From ae4f660d5ec4c8e72a0723cf60220049c64aa35e Mon Sep 17 00:00:00 2001 From: adrien2p Date: Sat, 26 Feb 2022 11:47:43 +0100 Subject: [PATCH] fix: Middleware loading on seprate domains --- src/loaders/admin-api.loader.ts | 6 +----- src/loaders/store-api.loader.ts | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/loaders/admin-api.loader.ts b/src/loaders/admin-api.loader.ts index 3ddb45f0..cd592f9e 100644 --- a/src/loaders/admin-api.loader.ts +++ b/src/loaders/admin-api.loader.ts @@ -19,11 +19,7 @@ export async function adminApiLoader( .map((middleware) => ({ ...middleware, routes: middleware.routes.filter((route) => { - if (route.path.startsWith('/admin')) { - route.path = route.path.replace('/admin', ''); - return true; - } - return false; + return route.path.startsWith('*') || route.path.startsWith('/admin'); }), })) .filter((middleware) => middleware.routes.length); diff --git a/src/loaders/store-api.loader.ts b/src/loaders/store-api.loader.ts index 3746edcc..df88a1d7 100644 --- a/src/loaders/store-api.loader.ts +++ b/src/loaders/store-api.loader.ts @@ -19,11 +19,7 @@ export async function storeApiLoader( .map((middleware) => ({ ...middleware, routes: middleware.routes.filter((route) => { - if (route.path.startsWith('/store')) { - route.path = route.path.replace('/store', ''); - return true; - } - return false; + return route.path.startsWith('*') || route.path.startsWith('/store'); }), })) .filter((middleware) => middleware.routes.length);