Skip to content

Commit

Permalink
fix: invoice,shoppingList,quote detail page link
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianJiang2021 authored and libruce committed Mar 19, 2024
1 parent a345320 commit 89e6454
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions apps/storefront/src/shared/routes/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[] => {
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
})
Expand Down

0 comments on commit 89e6454

Please sign in to comment.