Fixed Acc deleted Warnung im Profil
This commit is contained in:
1
apps/dispatch/next-env.d.ts
vendored
1
apps/dispatch/next-env.d.ts
vendored
@@ -1,6 +1,5 @@
|
|||||||
/// <reference types="next" />
|
/// <reference types="next" />
|
||||||
/// <reference types="next/image-types/global" />
|
/// <reference types="next/image-types/global" />
|
||||||
import "./.next/dev/types/routes.d.ts";
|
|
||||||
|
|
||||||
// NOTE: This file should not be edited
|
// NOTE: This file should not be edited
|
||||||
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
||||||
|
|||||||
@@ -704,23 +704,15 @@ export const AdminForm = ({
|
|||||||
<div role="alert" className="alert alert-warning alert-outline flex flex-col">
|
<div role="alert" className="alert alert-warning alert-outline flex flex-col">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<TriangleAlert />
|
<TriangleAlert />
|
||||||
{openBans.map((ban) => (
|
<div>
|
||||||
<div key={ban.id}>
|
<h3 className="text-lg font-semibold">Account gelöscht</h3>
|
||||||
<h3 className="text-lg font-semibold">Account gelöscht</h3>
|
</div>
|
||||||
</div>
|
<div>
|
||||||
))}
|
<h3 className="text-lg font-semibold">
|
||||||
{openTimebans.map((timeban) => (
|
Dieser Account ist als gelöscht markiert, der Nutzer kann sich nicht mehr anmelden.
|
||||||
<div key={timeban.id}>
|
</h3>
|
||||||
<h3 className="text-lg font-semibold">
|
</div>
|
||||||
Dieser Account ist als gelöscht markiert, der Nutzer kann sich nicht mehr
|
|
||||||
anmelden.
|
|
||||||
</h3>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</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>
|
</div>
|
||||||
)}
|
)}
|
||||||
{(user.CanonicalUser || (user.Duplicates && user.Duplicates.length > 0)) && (
|
{(user.CanonicalUser || (user.Duplicates && user.Duplicates.length > 0)) && (
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { NextRequest, NextResponse } from "next/server";
|
import { NextRequest, NextResponse } from "next/server";
|
||||||
import { DiscordAccount, prisma } from "@repo/db";
|
import { prisma } from "@repo/db";
|
||||||
import { getServerSession } from "../auth/[...nextauth]/auth";
|
import { getServerSession } from "../auth/[...nextauth]/auth";
|
||||||
import { setStandardName } from "../../../helper/discord";
|
import { setStandardName } from "../../../helper/discord";
|
||||||
import { getUserPenaltys } from "@repo/shared-components";
|
import { getUserPenaltys } from "@repo/shared-components";
|
||||||
@@ -52,8 +52,7 @@ export const GET = async (req: NextRequest) => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const discordObject = {
|
const discordData = {
|
||||||
userId: session.user.id,
|
|
||||||
accessToken: authData.access_token,
|
accessToken: authData.access_token,
|
||||||
refreshToken: authData.refresh_token,
|
refreshToken: authData.refresh_token,
|
||||||
discordId: discordUser.id,
|
discordId: discordUser.id,
|
||||||
@@ -63,12 +62,19 @@ export const GET = async (req: NextRequest) => {
|
|||||||
globalName: discordUser.global_name || discordUser.username,
|
globalName: discordUser.global_name || discordUser.username,
|
||||||
verified: discordUser.verified,
|
verified: discordUser.verified,
|
||||||
tokenType: authData.token_type,
|
tokenType: authData.token_type,
|
||||||
} as DiscordAccount;
|
};
|
||||||
|
|
||||||
await prisma.discordAccount.upsert({
|
await prisma.discordAccount.upsert({
|
||||||
where: { discordId: discordUser.id },
|
where: { discordId: discordUser.id },
|
||||||
update: discordObject, // Updates if found
|
update: discordData, // Updates if found
|
||||||
create: discordObject, // Creates if not found
|
create: {
|
||||||
|
...discordData,
|
||||||
|
User: {
|
||||||
|
connect: {
|
||||||
|
id: session.user.id,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}, // Creates if not found
|
||||||
});
|
});
|
||||||
const user = await prisma.user.findUnique({
|
const user = await prisma.user.findUnique({
|
||||||
where: { id: session.user.id },
|
where: { id: session.user.id },
|
||||||
|
|||||||
Reference in New Issue
Block a user