Fix admin auth redirect path on dynamic routes
This commit is contained in:
@@ -64,10 +64,10 @@ const AdminPageWrapper: React.FC<PageProps> = ({ requiresAuthentication, childre
|
||||
const router = useRouter();
|
||||
const { completed, redirecting } = useShouldRedirect(requiresAuthentication);
|
||||
|
||||
const { pathname } = router;
|
||||
const { asPath } = router;
|
||||
|
||||
if (redirecting) {
|
||||
const loginURL = `/admin/login?next=${pathname}`;
|
||||
const loginURL = `/admin/login?next=${asPath}`;
|
||||
router.push(loginURL);
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ const AdminPageWrapper: React.FC<PageProps> = ({ requiresAuthentication, childre
|
||||
<>
|
||||
<AdminHeader />
|
||||
<Main>
|
||||
<AdminSidebar path={pathname} />
|
||||
<AdminSidebar path={asPath} />
|
||||
{children}
|
||||
</Main>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user