fixed dispatch eslint errors
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { prisma, Prisma } from "@repo/db";
|
||||
import { prisma } from "@repo/db";
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
export async function GET(request: NextRequest): Promise<NextResponse> {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { AuthOptions, getServerSession as getNextAuthServerSession } from "next-auth";
|
||||
import { PrismaAdapter } from "@next-auth/prisma-adapter";
|
||||
import Credentials from "next-auth/providers/credentials";
|
||||
import { prisma, PrismaClient } from "@repo/db";
|
||||
import { prisma } from "@repo/db";
|
||||
|
||||
export const options: AuthOptions = {
|
||||
providers: [
|
||||
@@ -9,7 +10,7 @@ export const options: AuthOptions = {
|
||||
credentials: {
|
||||
code: { label: "code", type: "code" },
|
||||
},
|
||||
async authorize(credentials, req) {
|
||||
async authorize(credentials) {
|
||||
try {
|
||||
if (!credentials) throw new Error("No credentials provided");
|
||||
const code = await prisma.oAuthToken.findFirstOrThrow({
|
||||
@@ -60,7 +61,7 @@ export const options: AuthOptions = {
|
||||
|
||||
adapter: PrismaAdapter(prisma as any),
|
||||
callbacks: {
|
||||
jwt: async ({ token, user, ...rest }) => {
|
||||
jwt: async ({ token, user }) => {
|
||||
if (user && "firstname" in user) {
|
||||
return {
|
||||
...token,
|
||||
@@ -69,7 +70,7 @@ export const options: AuthOptions = {
|
||||
}
|
||||
return token;
|
||||
},
|
||||
session: async ({ session, user, token }) => {
|
||||
session: async ({ session, token }) => {
|
||||
const dbUser = await prisma.user.findUnique({
|
||||
where: {
|
||||
id: token?.sub,
|
||||
|
||||
@@ -3,15 +3,10 @@ import { RoomManager } from "_helpers/LivekitRoomManager";
|
||||
import { getServerSession } from "api/auth/[...nextauth]/auth";
|
||||
import { NextRequest } from "next/server";
|
||||
|
||||
export const GET = async (request: NextRequest) => {
|
||||
export const GET = async () => {
|
||||
const session = await getServerSession();
|
||||
|
||||
if (!session) return Response.json({ message: "Unauthorized" }, { status: 401 });
|
||||
const user = await prisma.user.findUnique({
|
||||
where: {
|
||||
id: session.user.id,
|
||||
},
|
||||
});
|
||||
|
||||
const rooms = await RoomManager.listRooms();
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { getServerSession } from "api/auth/[...nextauth]/auth";
|
||||
import { ROOMS } from "_data/livekitRooms";
|
||||
import { AccessToken } from "livekit-server-sdk";
|
||||
import { NextRequest } from "next/server";
|
||||
import { getPublicUser, prisma } from "@repo/db";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { PositionLog, Prisma, prisma, User } from "@repo/db";
|
||||
import { PositionLog, prisma, User } from "@repo/db";
|
||||
import { getServerSession } from "api/auth/[...nextauth]/auth";
|
||||
import { verify } from "jsonwebtoken";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user