|
|
@@ -70,11 +70,6 @@ export default async function middleware( |
|
|
|
response.cookies.set("i18next", langPref); |
|
|
|
return response; |
|
|
|
} |
|
|
|
|
|
|
|
let abilities: string[] = [] |
|
|
|
if (token) { |
|
|
|
abilities = (token.abilities as ability[]).map((item: ability) => item.actionSubjectCombo); |
|
|
|
} |
|
|
|
|
|
|
|
const authMiddleware = withAuth({ |
|
|
|
pages: authOptions.pages, |
|
|
@@ -84,6 +79,7 @@ export default async function middleware( |
|
|
|
if (!Boolean(token)) { |
|
|
|
return Boolean(token) |
|
|
|
} |
|
|
|
const abilities = (token!.abilities as ability[]).map((item: ability) => item.actionSubjectCombo); |
|
|
|
if (req.nextUrl.pathname.startsWith('/settings')) { |
|
|
|
isAuth = [VIEW_MASTERDATA, MAINTAIN_MASTERDATA].some((ability) => abilities.includes(ability)); |
|
|
|
} |
|
|
|