Fix all NextAuth v4 imports across codebase

This commit is contained in:
2025-12-02 14:03:13 +00:00
parent 2f7bc4fe8e
commit d7297248c1
11 changed files with 48 additions and 39 deletions

View File

@@ -2,7 +2,8 @@
import { prisma } from './db'
import { revalidatePath } from 'next/cache'
import { auth } from '@/auth'
import { getServerSession } from 'next-auth'
import { authOptions } from '@/pages/api/auth/[...nextauth]'
import { z } from 'zod'
import { checkRateLimit, INVITATION_RATE_LIMIT } from './rate-limit'
@@ -57,7 +58,7 @@ export async function inviteUserToList(
) {
try {
// Get current user session
const session = await auth()
const session = await getServerSession(authOptions)
if (!session?.user?.id) {
throw new Error('Unauthorized: Please log in to invite users')
}
@@ -187,7 +188,7 @@ export async function inviteUserToList(
export async function getInvitations() {
try {
// Get current user session
const session = await auth()
const session = await getServerSession(authOptions)
if (!session?.user?.id || !session?.user?.email) {
throw new Error('Unauthorized: Please log in to view invitations')
}
@@ -237,7 +238,7 @@ export async function getInvitations() {
export async function acceptInvitation(invitationId: string) {
try {
// Get current user session
const session = await auth()
const session = await getServerSession(authOptions)
if (!session?.user?.id || !session?.user?.email) {
throw new Error('Unauthorized: Please log in to accept invitations')
}
@@ -345,7 +346,7 @@ export async function acceptInvitation(invitationId: string) {
export async function declineInvitation(invitationId: string) {
try {
// Get current user session
const session = await auth()
const session = await getServerSession(authOptions)
if (!session?.user?.id || !session?.user?.email) {
throw new Error('Unauthorized: Please log in to decline invitations')
}
@@ -408,7 +409,7 @@ export async function declineInvitation(invitationId: string) {
export async function getCollaborators(listId: string) {
try {
// Get current user session
const session = await auth()
const session = await getServerSession(authOptions)
if (!session?.user?.id) {
throw new Error('Unauthorized: Please log in to view collaborators')
}
@@ -488,7 +489,7 @@ export async function updateCollaboratorPermission(
) {
try {
// Get current user session
const session = await auth()
const session = await getServerSession(authOptions)
if (!session?.user?.id) {
throw new Error('Unauthorized: Please log in to update permissions')
}
@@ -566,7 +567,7 @@ export async function removeCollaborator(
) {
try {
// Get current user session
const session = await auth()
const session = await getServerSession(authOptions)
if (!session?.user?.id) {
throw new Error('Unauthorized: Please log in to remove collaborators')
}