I have this function which should redirect the user if there is auth token and onBoarding is true. P op
// Check user onBoading status
if (authToken && authToken?.onboardingDone == true) {
console.log('admin onbaordin nehat run ')
const requestedPath = request.nextUrl.pathname;
const onBoardingRequestedPath = excludedUrlsOnbaording.some((url) =>{
console.log(url)
return requestedPath.startsWith(url)
}
);
if (onBoardingRequestedPath) {
// Redirect the user to a different URL
return redirectToRoleHome(roles, request);
}
}