From 89e645490774f3df55e6b1d7e2307f9a92cf6a9a Mon Sep 17 00:00:00 2001 From: BrianJiang2021 Date: Tue, 19 Mar 2024 17:04:46 +0800 Subject: [PATCH] fix: invoice,shoppingList,quote detail page link --- apps/storefront/src/shared/routes/routes.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/storefront/src/shared/routes/routes.ts b/apps/storefront/src/shared/routes/routes.ts index 205de014..2fbfa7fa 100644 --- a/apps/storefront/src/shared/routes/routes.ts +++ b/apps/storefront/src/shared/routes/routes.ts @@ -297,6 +297,8 @@ const firstLevelRouting: RouteFirstLevelItem[] = [ const denyInvoiceRoles = [4, 99, 100] +const invoiceFlag = 'invoice?invoiceId' + const { hash, pathname, href } = window.location const getAllowedRoutes = (globalState: GlobalState): RouteItem[] => { @@ -393,7 +395,7 @@ const gotoAllowedAppPage = async ( gotoPage('/login?loginFlag=3&&closeIsLogout=1') return } - if (denyInvoiceRoles.includes(role) && href.includes('invoice?invoiceId')) { + if (denyInvoiceRoles.includes(role) && href.includes(invoiceFlag)) { gotoPage('/login?loginFlag=7') return } @@ -429,8 +431,8 @@ const gotoAllowedAppPage = async ( } const flag = routes.some((item: RouteItem) => { - if (url.includes(item.path)) { - return matchPath(item.path, url) || item.permissions.includes(role) + if (matchPath(item.path, url) || url.includes(invoiceFlag)) { + return item.permissions.includes(role) } return false })