|
@@ -1,6 +1,5 @@
|
|
|
import React from 'react';
|
|
import React from 'react';
|
|
|
|
|
|
|
|
-import { pagePathUtils } from '@growi/core/dist/utils';
|
|
|
|
|
import type {
|
|
import type {
|
|
|
NextPage, GetServerSideProps, GetServerSidePropsContext,
|
|
NextPage, GetServerSideProps, GetServerSidePropsContext,
|
|
|
} from 'next';
|
|
} from 'next';
|
|
@@ -128,15 +127,7 @@ async function injectServerConfigurations(context: GetServerSidePropsContext, pr
|
|
|
export const getServerSideProps: GetServerSideProps = async(context: GetServerSidePropsContext) => {
|
|
export const getServerSideProps: GetServerSideProps = async(context: GetServerSidePropsContext) => {
|
|
|
const result = await getServerSideCommonProps(context);
|
|
const result = await getServerSideCommonProps(context);
|
|
|
|
|
|
|
|
- const { isPermalink, isUserPage, isUsersTopPage } = pagePathUtils;
|
|
|
|
|
-
|
|
|
|
|
- // redirect to the page the user was on before moving to the Login Page
|
|
|
|
|
- if (context.req.headers.referer != null) {
|
|
|
|
|
- const urlBeforeLogin = new URL(context.req.headers.referer);
|
|
|
|
|
- if (isPermalink(urlBeforeLogin.pathname) || isUserPage(urlBeforeLogin.pathname) || isUsersTopPage(urlBeforeLogin.pathname)) {
|
|
|
|
|
- (context.req as CrowiRequest).session.redirectTo = urlBeforeLogin.href;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ (context.req as CrowiRequest).session.redirectTo = context.req.headers.referer;
|
|
|
|
|
|
|
|
// check for presence
|
|
// check for presence
|
|
|
// see: https://github.com/vercel/next.js/issues/19271#issuecomment-730006862
|
|
// see: https://github.com/vercel/next.js/issues/19271#issuecomment-730006862
|