mirror of
https://github.com/DeveloLongScript/MHSF.git
synced 2026-05-07 13:54:59 -05:00
fix: unlinking doesn't work
This commit is contained in:
parent
a319f53381
commit
ceedade382
@ -46,13 +46,13 @@ export default async function handler(
|
||||
|
||||
const db = client.db(process.env.CUSTOM_MONGO_DB ?? "mhsf");
|
||||
const users = db.collection("claimed-users");
|
||||
const user = await (await clerkClient()).users.getUser(userId);
|
||||
|
||||
if (user.publicMetadata.player == undefined) {
|
||||
if ((await users.find({ userId }).toArray()).length === 0) {
|
||||
res.status(400).send({ result: "Hasn't linked yet!" });
|
||||
return;
|
||||
}
|
||||
await users.findOneAndDelete({ player: user.publicMetadata.player });
|
||||
await users.findOneAndDelete({ userId });
|
||||
const user = await (await clerkClient()).users.getUser(userId);
|
||||
|
||||
await (
|
||||
await clerkClient()
|
||||
).users.updateUserMetadata(userId, {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user