Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
fix: unstable prefix from getServerSession (#6175)
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-mba authored Apr 27, 2023
1 parent ecd69d9 commit 5d58210
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions pages/account/no-profile.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { authOptions } from "../api/auth/[...nextauth]";
import { unstable_getServerSession } from "next-auth/next";
import { getServerSession } from "next-auth/next";
import Page from "@components/Page";
import PageHead from "@components/PageHead";

export async function getServerSideProps(context) {
const session = await unstable_getServerSession(
const session = await getServerSession(
context.req,
context.res,
authOptions
Expand Down
4 changes: 2 additions & 2 deletions pages/account/statistics.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { authOptions } from "../api/auth/[...nextauth]";
import { unstable_getServerSession } from "next-auth/next";
import { getServerSession } from "next-auth/next";
import ProgressBar from "@components/statistics/ProgressBar";

import {
Expand All @@ -22,7 +22,7 @@ import BasicCards from "@components/statistics/BasicCards";

export async function getServerSideProps(context) {
const { req, res } = context;
const session = await unstable_getServerSession(req, res, authOptions);
const session = await getServerSession(req, res, authOptions);

if (!session) {
return {
Expand Down
4 changes: 2 additions & 2 deletions pages/api/account/statistics.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { authOptions } from "../auth/[...nextauth]";
import { unstable_getServerSession } from "next-auth/next";
import { getServerSession } from "next-auth/next";

import connectMongo from "@config/mongo";
import logger from "@config/logger";
Expand All @@ -9,7 +9,7 @@ import Link from "@models/Link";
import LinkStats from "@models/LinkStats";

export default async function handler(req, res) {
const session = await unstable_getServerSession(req, res, authOptions);
const session = await getServerSession(req, res, authOptions);

if (!session) {
res.status(401).json({ message: "You must be logged in." });
Expand Down
4 changes: 2 additions & 2 deletions pages/api/users/[username]/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { authOptions } from "../../auth/[...nextauth]";
import { unstable_getServerSession } from "next-auth/next";
import { getServerSession } from "next-auth/next";

import connectMongo from "@config/mongo";
import logger from "@config/logger";
Expand All @@ -25,7 +25,7 @@ export default async function handler(req, res) {
export async function getUserApi(req, res, username) {
await connectMongo();
let isOwner = false;
const session = await unstable_getServerSession(req, res, authOptions);
const session = await getServerSession(req, res, authOptions);
if (session && session.username === username) {
isOwner = true;
}
Expand Down

0 comments on commit 5d58210

Please sign in to comment.