mirror of
https://github.com/DeveloLongScript/MHSF.git
synced 2026-05-07 16:05:00 -05:00
fix(server-linking): remove useless backend condition
This commit is contained in:
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();
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user