fix(server-linking): remove useless backend condition

This commit is contained in:
dvelo 2025-03-02 15:27:07 -06:00
parent 1a6e50868c
commit e729895729

@ -29,12 +29,12 @@
*/ */
import { NextApiRequest, NextApiResponse } from "next"; import { NextApiRequest, NextApiResponse } from "next";
import { clerkClient, getAuth } from "@clerk/nextjs/server"; import { getAuth } from "@clerk/nextjs/server";
import { MongoClient } from "mongodb"; import { MongoClient } from "mongodb";
export default async function handler( export default async function handler(
req: NextApiRequest, req: NextApiRequest,
res: NextApiResponse res: NextApiResponse,
) { ) {
const { userId } = getAuth(req); const { userId } = getAuth(req);
const { server } = req.body; const { server } = req.body;
@ -47,12 +47,6 @@ export default async function handler(
if (!userId) { if (!userId) {
return res.status(401).json({ error: "Unauthorized" }); return res.status(401).json({ error: "Unauthorized" });
} }
if (
(await (await clerkClient()).users.getUser(userId)).publicMetadata.player ==
undefined
) {
return res.status(401).json({ error: "Account not linked" });
}
const client = new MongoClient(process.env.MONGO_DB as string); const client = new MongoClient(process.env.MONGO_DB as string);
await client.connect(); await client.connect();