fix: redirection after login (#320)

This commit is contained in:
Dakshesh Jain 2023-02-22 17:54:27 +05:30 committed by GitHub
parent d29f34566c
commit c1a78cc230
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 30 additions and 27 deletions

View File

@ -28,7 +28,7 @@ import { renderShortNumericDateFormat, findHowManyDaysLeft } from "helpers/date-
import { addSpaceIfCamelCase } from "helpers/string.helper";
import { groupBy } from "helpers/array.helper";
// types
import type { NextPage, NextPageContext } from "next";
import type { NextPage, GetServerSidePropsContext } from "next";
const WorkspacePage: NextPage = () => {
// 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 redirectAfterSignIn = ctx.req?.url;
const redirectAfterSignIn = ctx.resolvedUrl;
if (!user) {
return {

View File

@ -36,7 +36,7 @@ import {
XMarkIcon,
} from "@heroicons/react/24/outline";
// types
import type { NextPage, NextPageContext } from "next";
import type { NextPage, GetServerSidePropsContext } from "next";
import type { IIssue, IUser } from "types";
// 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 redirectAfterSignIn = ctx.req?.url;
const redirectAfterSignIn = ctx.resolvedUrl;
if (!user) {
return {

View File

@ -3,7 +3,7 @@ import React, { useState } from "react";
import { useRouter } from "next/router";
import useSWR, { mutate } from "swr";
import { NextPageContext } from "next";
import { GetServerSidePropsContext } from "next";
// icons
import { ArrowLeftIcon, ListBulletIcon, PlusIcon } from "@heroicons/react/24/outline";
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 redirectAfterSignIn = ctx.req?.url;
const redirectAfterSignIn = ctx.resolvedUrl;
if (!user) {
return {

View File

@ -22,7 +22,7 @@ import { BreadcrumbItem, Breadcrumbs } from "components/breadcrumbs";
// icons
// types
import { ICycle, SelectCycleType } from "types";
import type { NextPage, NextPageContext } from "next";
import type { NextPage, GetServerSidePropsContext } from "next";
// fetching 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 redirectAfterSignIn = ctx.req?.url;
const redirectAfterSignIn = ctx.resolvedUrl;
if (!user) {
return {

View File

@ -26,7 +26,7 @@ import { Loader, CustomMenu } from "components/ui";
import { Breadcrumbs } from "components/breadcrumbs";
// types
import { IIssue, UserAuth } from "types";
import type { NextPage, NextPageContext } from "next";
import type { GetServerSidePropsContext, NextPage } from "next";
// 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 redirectAfterSignIn = ctx.req?.url;
const redirectAfterSignIn = ctx.resolvedUrl;
if (!user) {
return {

View File

@ -20,7 +20,7 @@ import { BreadcrumbItem, Breadcrumbs } from "components/breadcrumbs";
import { RectangleStackIcon, PlusIcon } from "@heroicons/react/24/outline";
// types
import type { UserAuth } from "types";
import type { NextPage, NextPageContext } from "next";
import type { GetServerSidePropsContext, NextPage } from "next";
// 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 redirectAfterSignIn = ctx.req?.url;
const redirectAfterSignIn = ctx.resolvedUrl;
if (!user) {
return {

View File

@ -1,7 +1,7 @@
import React, { useState } from "react";
import { useRouter } from "next/router";
import { NextPageContext } from "next";
import { GetServerSidePropsContext } from "next";
import useSWR, { mutate } from "swr";
// 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 redirectAfterSignIn = ctx.req?.url;
const redirectAfterSignIn = ctx.resolvedUrl;
if (!user) {
return {

View File

@ -20,7 +20,7 @@ import { BreadcrumbItem, Breadcrumbs } from "components/breadcrumbs";
// types
import { IModule, SelectModuleType } from "types/modules";
// fetch-keys
import type { NextPage, NextPageContext } from "next";
import type { NextPage, GetServerSidePropsContext } from "next";
import { MODULE_LIST, PROJECT_DETAILS } from "constants/fetch-keys";
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 redirectAfterSignIn = ctx.req?.url;
const redirectAfterSignIn = ctx.resolvedUrl;
if (!user) {
return {

View File

@ -23,7 +23,7 @@ import CommandMenu from "components/onboarding/command-menu";
// images
import Logo from "public/onboarding/logo.svg";
// types
import type { NextPage, NextPageContext } from "next";
import type { NextPage, GetServerSidePropsContext } from "next";
const Onboarding: NextPage = () => {
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 redirectAfterSignIn = ctx.req?.url;
const redirectAfterSignIn = ctx.resolvedUrl;
if (!user) {
return {