Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Node, update severSession function #384

Merged
merged 1 commit into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/PromptService/PromptService.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useRouter } from "next/router";
import React, { useState, useEffect, useCallback } from "react";
import { Modal } from "../Modal/Modal";
import { ExclamationIcon, PlusSmIcon, XIcon } from "@heroicons/react/outline";
import { ExclamationIcon, XIcon } from "@heroicons/react/outline";
import { Dialog } from "@headlessui/react";

export interface serviceProps {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@
"typescript": "^4.6.4"
},
"volta": {
"node": "16.19.0",
"npm": "8.19.3"
"node": "18.17.1",
"npm": "9.6.7"
},
"overrides": {
"json5@<1.0.2": "1.0.2",
Expand Down
8 changes: 2 additions & 6 deletions pages/[username].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
} from "next";
import React from "react";
import Link from "next/link";
import { unstable_getServerSession } from "next-auth";
import { getServerSession } from "next-auth/next";
import { authOptions } from "./api/auth/[...nextauth]";
import prisma from "../server/db/client";
import Layout from "../components/Layout/Layout";
Expand Down Expand Up @@ -210,11 +210,7 @@ export const getServerSideProps = async (
};
}

const session = await unstable_getServerSession(
context.req,
context.res,
authOptions
);
const session = await getServerSession(context.req, context.res, authOptions);

const profile = await prisma.user.findUnique({
where: {
Expand Down
8 changes: 2 additions & 6 deletions pages/alpha/create-new/[[...postIdArr]].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { NextPage, GetServerSideProps } from "next";
import { ZodError } from "zod";
import { useRouter } from "next/router";
import React, { useState, useEffect, Fragment, useRef } from "react";
import { unstable_getServerSession } from "next-auth/next";
import { getServerSession } from "next-auth/next";
import { authOptions } from "../../api/auth/[...nextauth]";
import { useForm, Controller } from "react-hook-form";
import toast, { Toaster } from "react-hot-toast";
Expand Down Expand Up @@ -614,11 +614,7 @@ const Create: NextPage = () => {
};

export const getServerSideProps: GetServerSideProps = async (context) => {
const session = await unstable_getServerSession(
context.req,
context.res,
authOptions
);
const session = await getServerSession(context.req, context.res, authOptions);

if (!session) {
return {
Expand Down
10 changes: 4 additions & 6 deletions pages/alpha/create/[[...postIdArr]].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { NextPage, GetServerSideProps } from "next";
import { ZodError } from "zod";
import { useRouter } from "next/router";
import React, { useState, useEffect, Fragment, useRef } from "react";
import { unstable_getServerSession } from "next-auth/next";
import { getServerSession } from "next-auth/next";
import { authOptions } from "../../api/auth/[...nextauth]";
import { useForm } from "react-hook-form";
import CustomTextareaAutosize from "../../../components/CustomTextareAutosize/CustomTextareaAutosize";
Expand Down Expand Up @@ -265,6 +265,8 @@ const Create: NextPage = () => {
<LayoutEditor>
<div className="bg-smoke">
<PromptDialog
title="Unsaved Changes"
subTitle="You have unsaved changes, are you sure you want to leave?"
shouldConfirmLeave={unsavedChanges}
updateParent={handleOpenDialog}
/>
Expand Down Expand Up @@ -559,11 +561,7 @@ const Create: NextPage = () => {
};

export const getServerSideProps: GetServerSideProps = async (context) => {
const session = await unstable_getServerSession(
context.req,
context.res,
authOptions
);
const session = await getServerSession(context.req, context.res, authOptions);

if (!session) {
return {
Expand Down
8 changes: 2 additions & 6 deletions pages/create/[[...postIdArr]].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { NextPage, GetServerSideProps } from "next";
import { ZodError } from "zod";
import { useRouter } from "next/router";
import React, { useState, useEffect, Fragment, useRef } from "react";
import { unstable_getServerSession } from "next-auth/next";
import { getServerSession } from "next-auth/next";
import { authOptions } from "../api/auth/[...nextauth]";
import { useForm } from "react-hook-form";
import CustomTextareaAutosize from "../../components/CustomTextareAutosize/CustomTextareaAutosize";
Expand Down Expand Up @@ -615,11 +615,7 @@ const Create: NextPage = () => {
};

export const getServerSideProps: GetServerSideProps = async (context) => {
const session = await unstable_getServerSession(
context.req,
context.res,
authOptions
);
const session = await getServerSession(context.req, context.res, authOptions);

if (!session) {
return {
Expand Down
8 changes: 2 additions & 6 deletions pages/metrics/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Layout from "../../components/Layout/Layout";
import PageHeading from "../../components/PageHeading/PageHeading";
import { authOptions } from "../api/auth/[...nextauth]";
import { unstable_getServerSession } from "next-auth";
import { getServerSession } from "next-auth";
import type {
GetServerSideProps,
InferGetServerSidePropsType,
Expand Down Expand Up @@ -55,11 +55,7 @@ const Metrics: NextPage = ({
};

export const getServerSideProps: GetServerSideProps = async (context) => {
const session = await unstable_getServerSession(
context.req,
context.res,
authOptions
);
const session = await getServerSession(context.req, context.res, authOptions);

if (!session || !session?.user?.id) {
return {
Expand Down
Loading
Loading