Skip to content

Commit d059298

Browse files
Get server session update (#204)
Co-authored-by: Steven Tey <[email protected]>
1 parent 3c5f775 commit d059298

File tree

7 files changed

+1176
-5412
lines changed

7 files changed

+1176
-5412
lines changed

lib/api/post.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import prisma from "@/lib/prisma";
22

33
import { NextApiRequest, NextApiResponse } from "next";
4-
import { unstable_getServerSession } from "next-auth/next";
4+
import { getServerSession } from "next-auth/next";
55
import { authOptions } from "pages/api/auth/[...nextauth]";
66
import type { Post, Site } from ".prisma/client";
77
import type { Session } from "next-auth";

lib/api/site.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import cuid from "cuid";
22
import { NextApiRequest, NextApiResponse } from "next";
3-
import { unstable_getServerSession } from "next-auth/next";
3+
import { getServerSession } from "next-auth/next";
44
import { authOptions } from "pages/api/auth/[...nextauth]";
55
import prisma from "@/lib/prisma";
66

@@ -127,7 +127,7 @@ export async function deleteSite(
127127
req: NextApiRequest,
128128
res: NextApiResponse
129129
): Promise<void | NextApiResponse> {
130-
const session = await unstable_getServerSession(req, res, authOptions);
130+
const session = await getServerSession(req, res, authOptions);
131131
if (!session?.user.id) return res.status(401).end("Unauthorized");
132132
const { siteId } = req.query;
133133

@@ -192,7 +192,7 @@ export async function updateSite(
192192
req: NextApiRequest,
193193
res: NextApiResponse
194194
): Promise<void | NextApiResponse<Site>> {
195-
const session = await unstable_getServerSession(req, res, authOptions);
195+
const session = await getServerSession(req, res, authOptions);
196196
if (!session?.user.id) return res.status(401).end("Unauthorized");
197197

198198
const {

0 commit comments

Comments
 (0)