mirror of
https://github.com/DeveloLongScript/MHSF.git
synced 2026-05-09 13:44:58 -05:00
Compare commits
No commits in common. "67bdca85165191d6483537b2d8433a6892359f46" and "a319f533810caded629b2e727e9b853f1fd4ca2c" have entirely different histories.
67bdca8516
...
a319f53381
@ -290,6 +290,7 @@ export async function unlinkMCAccount(): Promise<boolean> {
|
||||
const response = await fetch(
|
||||
connector(`/account-linking/unlink-account`, { version: 0 }),
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
|
||||
@ -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");
|
||||
if ((await users.find({ userId }).toArray()).length === 0) {
|
||||
const user = await (await clerkClient()).users.getUser(userId);
|
||||
|
||||
if (user.publicMetadata.player == undefined) {
|
||||
res.status(400).send({ result: "Hasn't linked yet!" });
|
||||
return;
|
||||
}
|
||||
await users.findOneAndDelete({ userId });
|
||||
const user = await (await clerkClient()).users.getUser(userId);
|
||||
|
||||
await users.findOneAndDelete({ player: user.publicMetadata.player });
|
||||
await (
|
||||
await clerkClient()
|
||||
).users.updateUserMetadata(userId, {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user