mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: redirection after login (#320)
This commit is contained in:
parent
d29f34566c
commit
c1a78cc230
@ -28,7 +28,7 @@ import { renderShortNumericDateFormat, findHowManyDaysLeft } from "helpers/date-
|
|||||||
import { addSpaceIfCamelCase } from "helpers/string.helper";
|
import { addSpaceIfCamelCase } from "helpers/string.helper";
|
||||||
import { groupBy } from "helpers/array.helper";
|
import { groupBy } from "helpers/array.helper";
|
||||||
// types
|
// types
|
||||||
import type { NextPage, NextPageContext } from "next";
|
import type { NextPage, GetServerSidePropsContext } from "next";
|
||||||
|
|
||||||
const WorkspacePage: NextPage = () => {
|
const WorkspacePage: NextPage = () => {
|
||||||
// router
|
// router
|
||||||
@ -226,10 +226,10 @@ const WorkspacePage: NextPage = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getServerSideProps = async (ctx: NextPageContext) => {
|
export const getServerSideProps = async (ctx: GetServerSidePropsContext) => {
|
||||||
const user = await requiredAuth(ctx.req?.headers.cookie);
|
const user = await requiredAuth(ctx.req?.headers.cookie);
|
||||||
|
|
||||||
const redirectAfterSignIn = ctx.req?.url;
|
const redirectAfterSignIn = ctx.resolvedUrl;
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return {
|
return {
|
||||||
|
@ -36,7 +36,7 @@ import {
|
|||||||
XMarkIcon,
|
XMarkIcon,
|
||||||
} from "@heroicons/react/24/outline";
|
} from "@heroicons/react/24/outline";
|
||||||
// types
|
// types
|
||||||
import type { NextPage, NextPageContext } from "next";
|
import type { NextPage, GetServerSidePropsContext } from "next";
|
||||||
import type { IIssue, IUser } from "types";
|
import type { IIssue, IUser } from "types";
|
||||||
// fetch-keys
|
// fetch-keys
|
||||||
import { USER_ISSUE, USER_WORKSPACE_INVITATIONS, PROJECTS_LIST } from "constants/fetch-keys";
|
import { USER_ISSUE, USER_WORKSPACE_INVITATIONS, PROJECTS_LIST } from "constants/fetch-keys";
|
||||||
@ -297,10 +297,10 @@ const Profile: NextPage = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getServerSideProps = async (ctx: NextPageContext) => {
|
export const getServerSideProps = async (ctx: GetServerSidePropsContext) => {
|
||||||
const user = await requiredAuth(ctx.req?.headers.cookie);
|
const user = await requiredAuth(ctx.req?.headers.cookie);
|
||||||
|
|
||||||
const redirectAfterSignIn = ctx.req?.url;
|
const redirectAfterSignIn = ctx.resolvedUrl;
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return {
|
return {
|
||||||
|
@ -3,7 +3,7 @@ import React, { useState } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
|
||||||
import useSWR, { mutate } from "swr";
|
import useSWR, { mutate } from "swr";
|
||||||
import { NextPageContext } from "next";
|
import { GetServerSidePropsContext } from "next";
|
||||||
// icons
|
// icons
|
||||||
import { ArrowLeftIcon, ListBulletIcon, PlusIcon } from "@heroicons/react/24/outline";
|
import { ArrowLeftIcon, ListBulletIcon, PlusIcon } from "@heroicons/react/24/outline";
|
||||||
import { CyclesIcon } from "components/icons";
|
import { CyclesIcon } from "components/icons";
|
||||||
@ -226,9 +226,10 @@ const SingleCycle: React.FC<UserAuth> = (props) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getServerSideProps = async (ctx: NextPageContext) => {
|
export const getServerSideProps = async (ctx: GetServerSidePropsContext) => {
|
||||||
const user = await requiredAuth(ctx.req?.headers.cookie);
|
const user = await requiredAuth(ctx.req?.headers.cookie);
|
||||||
const redirectAfterSignIn = ctx.req?.url;
|
|
||||||
|
const redirectAfterSignIn = ctx.resolvedUrl;
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return {
|
return {
|
||||||
|
@ -22,7 +22,7 @@ import { BreadcrumbItem, Breadcrumbs } from "components/breadcrumbs";
|
|||||||
// icons
|
// icons
|
||||||
// types
|
// types
|
||||||
import { ICycle, SelectCycleType } from "types";
|
import { ICycle, SelectCycleType } from "types";
|
||||||
import type { NextPage, NextPageContext } from "next";
|
import type { NextPage, GetServerSidePropsContext } from "next";
|
||||||
// fetching keys
|
// fetching keys
|
||||||
import { CYCLE_LIST, PROJECT_DETAILS, WORKSPACE_DETAILS } from "constants/fetch-keys";
|
import { CYCLE_LIST, PROJECT_DETAILS, WORKSPACE_DETAILS } from "constants/fetch-keys";
|
||||||
|
|
||||||
@ -200,10 +200,10 @@ const ProjectCycles: NextPage = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getServerSideProps = async (ctx: NextPageContext) => {
|
export const getServerSideProps = async (ctx: GetServerSidePropsContext) => {
|
||||||
const user = await requiredAuth(ctx.req?.headers.cookie);
|
const user = await requiredAuth(ctx.req?.headers.cookie);
|
||||||
|
|
||||||
const redirectAfterSignIn = ctx.req?.url;
|
const redirectAfterSignIn = ctx.resolvedUrl;
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return {
|
return {
|
||||||
|
@ -26,7 +26,7 @@ import { Loader, CustomMenu } from "components/ui";
|
|||||||
import { Breadcrumbs } from "components/breadcrumbs";
|
import { Breadcrumbs } from "components/breadcrumbs";
|
||||||
// types
|
// types
|
||||||
import { IIssue, UserAuth } from "types";
|
import { IIssue, UserAuth } from "types";
|
||||||
import type { NextPage, NextPageContext } from "next";
|
import type { GetServerSidePropsContext, NextPage } from "next";
|
||||||
// fetch-keys
|
// fetch-keys
|
||||||
import { PROJECT_ISSUES_ACTIVITY, ISSUE_DETAILS, SUB_ISSUES } from "constants/fetch-keys";
|
import { PROJECT_ISSUES_ACTIVITY, ISSUE_DETAILS, SUB_ISSUES } from "constants/fetch-keys";
|
||||||
|
|
||||||
@ -233,10 +233,10 @@ const IssueDetailsPage: NextPage<UserAuth> = (props) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getServerSideProps = async (ctx: NextPageContext) => {
|
export const getServerSideProps = async (ctx: GetServerSidePropsContext) => {
|
||||||
const user = await requiredAuth(ctx.req?.headers.cookie);
|
const user = await requiredAuth(ctx.req?.headers.cookie);
|
||||||
|
|
||||||
const redirectAfterSignIn = ctx.req?.url;
|
const redirectAfterSignIn = ctx.resolvedUrl;
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return {
|
return {
|
||||||
|
@ -20,7 +20,7 @@ import { BreadcrumbItem, Breadcrumbs } from "components/breadcrumbs";
|
|||||||
import { RectangleStackIcon, PlusIcon } from "@heroicons/react/24/outline";
|
import { RectangleStackIcon, PlusIcon } from "@heroicons/react/24/outline";
|
||||||
// types
|
// types
|
||||||
import type { UserAuth } from "types";
|
import type { UserAuth } from "types";
|
||||||
import type { NextPage, NextPageContext } from "next";
|
import type { GetServerSidePropsContext, NextPage } from "next";
|
||||||
// fetch-keys
|
// fetch-keys
|
||||||
import { PROJECT_DETAILS, PROJECT_ISSUES_LIST } from "constants/fetch-keys";
|
import { PROJECT_DETAILS, PROJECT_ISSUES_LIST } from "constants/fetch-keys";
|
||||||
|
|
||||||
@ -111,9 +111,10 @@ const ProjectIssues: NextPage<UserAuth> = (props) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getServerSideProps = async (ctx: NextPageContext) => {
|
export const getServerSideProps = async (ctx: GetServerSidePropsContext) => {
|
||||||
const user = await requiredAuth(ctx.req?.headers.cookie);
|
const user = await requiredAuth(ctx.req?.headers.cookie);
|
||||||
const redirectAfterSignIn = ctx.req?.url;
|
|
||||||
|
const redirectAfterSignIn = ctx.resolvedUrl;
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return {
|
return {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
|
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { NextPageContext } from "next";
|
import { GetServerSidePropsContext } from "next";
|
||||||
import useSWR, { mutate } from "swr";
|
import useSWR, { mutate } from "swr";
|
||||||
|
|
||||||
// icons
|
// icons
|
||||||
@ -222,9 +222,10 @@ const SingleModule: React.FC<UserAuth> = (props) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getServerSideProps = async (ctx: NextPageContext) => {
|
export const getServerSideProps = async (ctx: GetServerSidePropsContext) => {
|
||||||
const user = await requiredAuth(ctx.req?.headers.cookie);
|
const user = await requiredAuth(ctx.req?.headers.cookie);
|
||||||
const redirectAfterSignIn = ctx.req?.url;
|
|
||||||
|
const redirectAfterSignIn = ctx.resolvedUrl;
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return {
|
return {
|
||||||
|
@ -20,7 +20,7 @@ import { BreadcrumbItem, Breadcrumbs } from "components/breadcrumbs";
|
|||||||
// types
|
// types
|
||||||
import { IModule, SelectModuleType } from "types/modules";
|
import { IModule, SelectModuleType } from "types/modules";
|
||||||
// fetch-keys
|
// fetch-keys
|
||||||
import type { NextPage, NextPageContext } from "next";
|
import type { NextPage, GetServerSidePropsContext } from "next";
|
||||||
import { MODULE_LIST, PROJECT_DETAILS } from "constants/fetch-keys";
|
import { MODULE_LIST, PROJECT_DETAILS } from "constants/fetch-keys";
|
||||||
|
|
||||||
const ProjectModules: NextPage = () => {
|
const ProjectModules: NextPage = () => {
|
||||||
@ -139,10 +139,10 @@ const ProjectModules: NextPage = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getServerSideProps = async (ctx: NextPageContext) => {
|
export const getServerSideProps = async (ctx: GetServerSidePropsContext) => {
|
||||||
const user = await requiredAuth(ctx.req?.headers.cookie);
|
const user = await requiredAuth(ctx.req?.headers.cookie);
|
||||||
|
|
||||||
const redirectAfterSignIn = ctx.req?.url;
|
const redirectAfterSignIn = ctx.resolvedUrl;
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return {
|
return {
|
||||||
|
@ -23,7 +23,7 @@ import CommandMenu from "components/onboarding/command-menu";
|
|||||||
// images
|
// images
|
||||||
import Logo from "public/onboarding/logo.svg";
|
import Logo from "public/onboarding/logo.svg";
|
||||||
// types
|
// types
|
||||||
import type { NextPage, NextPageContext } from "next";
|
import type { NextPage, GetServerSidePropsContext } from "next";
|
||||||
|
|
||||||
const Onboarding: NextPage = () => {
|
const Onboarding: NextPage = () => {
|
||||||
const [step, setStep] = useState(1);
|
const [step, setStep] = useState(1);
|
||||||
@ -92,10 +92,10 @@ const Onboarding: NextPage = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getServerSideProps = async (ctx: NextPageContext) => {
|
export const getServerSideProps = async (ctx: GetServerSidePropsContext) => {
|
||||||
const user = await requiredAuth(ctx.req?.headers.cookie);
|
const user = await requiredAuth(ctx.req?.headers.cookie);
|
||||||
|
|
||||||
const redirectAfterSignIn = ctx.req?.url;
|
const redirectAfterSignIn = ctx.resolvedUrl;
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user