Fixed Acc deleted Warnung im Profil
This commit is contained in:
@@ -704,23 +704,15 @@ export const AdminForm = ({
|
||||
<div role="alert" className="alert alert-warning alert-outline flex flex-col">
|
||||
<div className="flex items-center gap-2">
|
||||
<TriangleAlert />
|
||||
{openBans.map((ban) => (
|
||||
<div key={ban.id}>
|
||||
<h3 className="text-lg font-semibold">Account gelöscht</h3>
|
||||
</div>
|
||||
))}
|
||||
{openTimebans.map((timeban) => (
|
||||
<div key={timeban.id}>
|
||||
<h3 className="text-lg font-semibold">
|
||||
Dieser Account ist als gelöscht markiert, der Nutzer kann sich nicht mehr
|
||||
anmelden.
|
||||
</h3>
|
||||
</div>
|
||||
))}
|
||||
<div>
|
||||
<h3 className="text-lg font-semibold">Account gelöscht</h3>
|
||||
</div>
|
||||
<div>
|
||||
<h3 className="text-lg font-semibold">
|
||||
Dieser Account ist als gelöscht markiert, der Nutzer kann sich nicht mehr anmelden.
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<p className="text-sm text-gray-400">
|
||||
Achtung! Die Strafe(n) sind aktiv, die Rechte des Nutzers müssen nicht angepasst werden!
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
{(user.CanonicalUser || (user.Duplicates && user.Duplicates.length > 0)) && (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import axios from "axios";
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { DiscordAccount, prisma } from "@repo/db";
|
||||
import { prisma } from "@repo/db";
|
||||
import { getServerSession } from "../auth/[...nextauth]/auth";
|
||||
import { setStandardName } from "../../../helper/discord";
|
||||
import { getUserPenaltys } from "@repo/shared-components";
|
||||
@@ -52,8 +52,7 @@ export const GET = async (req: NextRequest) => {
|
||||
},
|
||||
});
|
||||
|
||||
const discordObject = {
|
||||
userId: session.user.id,
|
||||
const discordData = {
|
||||
accessToken: authData.access_token,
|
||||
refreshToken: authData.refresh_token,
|
||||
discordId: discordUser.id,
|
||||
@@ -63,12 +62,19 @@ export const GET = async (req: NextRequest) => {
|
||||
globalName: discordUser.global_name || discordUser.username,
|
||||
verified: discordUser.verified,
|
||||
tokenType: authData.token_type,
|
||||
} as DiscordAccount;
|
||||
};
|
||||
|
||||
await prisma.discordAccount.upsert({
|
||||
where: { discordId: discordUser.id },
|
||||
update: discordObject, // Updates if found
|
||||
create: discordObject, // Creates if not found
|
||||
update: discordData, // Updates if found
|
||||
create: {
|
||||
...discordData,
|
||||
User: {
|
||||
connect: {
|
||||
id: session.user.id,
|
||||
},
|
||||
},
|
||||
}, // Creates if not found
|
||||
});
|
||||
const user = await prisma.user.findUnique({
|
||||
where: { id: session.user.id },
|
||||
|
||||
Reference in New Issue
Block a user