Fix admin auth redirect path on dynamic routes

This commit is contained in:
Aarni Halinen
2021-09-04 13:38:52 +03:00
parent 2216c6481b
commit f3d233ae52
+3 -3
View File
@@ -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>
</>