mirror of
https://github.com/DeveloLongScript/MHSF.git
synced 2026-05-09 13:34:59 -05:00
Compare commits
4 Commits
0eef4ed4f6
...
4150d86ec7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4150d86ec7 | ||
|
|
67bdca8516 | ||
|
|
9afc39f4d6 | ||
|
|
ceedade382 |
@ -290,7 +290,6 @@ export async function unlinkMCAccount(): Promise<boolean> {
|
|||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
connector(`/account-linking/unlink-account`, { version: 0 }),
|
connector(`/account-linking/unlink-account`, { version: 0 }),
|
||||||
{
|
{
|
||||||
method: "POST",
|
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
},
|
},
|
||||||
|
|||||||
@ -46,13 +46,13 @@ export default async function handler(
|
|||||||
|
|
||||||
const db = client.db(process.env.CUSTOM_MONGO_DB ?? "mhsf");
|
const db = client.db(process.env.CUSTOM_MONGO_DB ?? "mhsf");
|
||||||
const users = db.collection("claimed-users");
|
const users = db.collection("claimed-users");
|
||||||
const user = await (await clerkClient()).users.getUser(userId);
|
if ((await users.find({ userId }).toArray()).length === 0) {
|
||||||
|
|
||||||
if (user.publicMetadata.player == undefined) {
|
|
||||||
res.status(400).send({ result: "Hasn't linked yet!" });
|
res.status(400).send({ result: "Hasn't linked yet!" });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await users.findOneAndDelete({ player: user.publicMetadata.player });
|
await users.findOneAndDelete({ userId });
|
||||||
|
const user = await (await clerkClient()).users.getUser(userId);
|
||||||
|
|
||||||
await (
|
await (
|
||||||
await clerkClient()
|
await clerkClient()
|
||||||
).users.updateUserMetadata(userId, {
|
).users.updateUserMetadata(userId, {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user