diff --git a/src/pages/api/account/changeemail.ts b/src/pages/api/account/changeemail.ts deleted file mode 100644 index 9615333..0000000 --- a/src/pages/api/account/changeemail.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { withSessionRoute } from "../../../lib/session"; -import { sha1Encrypt } from "../../../lib/crypt"; -import { NextApiRequest, NextApiResponse } from "next"; -import prisma from "../../../prisma"; -import apiHandler from "../../../middleware/apiHandler"; -import { Prisma } from "@prisma/client"; - -const post = withSessionRoute( - async (req: NextApiRequest, res: NextApiResponse) => { - const { user } = req.session; - if (!user) { - return res.status(403).json({ message: "Unauthorised." }); - } - - const { email, password } = req.body; - - let result: Prisma.BatchPayload | undefined; - - try { - result = await prisma.accounts.updateMany({ - where: { id: user.id, password: await sha1Encrypt(password) }, - data: { - email, - }, - }); - } catch (err) {} - - if (result && result.count == 0) { - return res.status(400).json({ - success: false, - message: "Current password doesn't match.", - }); - } - - res.json({ success: true, message: "Succesfully changed email." }); - } -); - -export default apiHandler({ - post, -}); diff --git a/src/pages/community/highscores.tsx b/src/pages/community/highscores.tsx index 68fe445..e73bc47 100644 --- a/src/pages/community/highscores.tsx +++ b/src/pages/community/highscores.tsx @@ -5,8 +5,7 @@ import StrippedTable from "@component/StrippedTable"; import { Box, Button, ButtonGroup, Flex, Heading, Text } from "@chakra-ui/react"; import { getVocationNameById, Vocation } from "@shared/enums/Vocation"; import { trpc } from "@util/trpc"; -import { Skill } from "@shared/enums/Skill"; -import { getSkillKeyByValue } from "@shared/enums/Skill"; +import { Skill, getSkillKeyByValue } from "@shared/enums/Skill"; const vocations: { label: string; value: Vocation | "all" }[] = [ { label: "All", value: "all" }, @@ -84,15 +83,12 @@ export default function Highscores() { [ - { text: `${index + 1}` }, - { text: player.name, href: `/character/${player.name}` }, - { text: getVocationNameById(player.vocation) }, - { text: player.level }, - ]) - } + body={highscores.data?.pages[0].players.map((player, index) => [ + { text: `${index + 1}` }, + { text: player.name, href: `/character/${player.name}` }, + { text: getVocationNameById(player.vocation) }, + { text: player.level }, + ])} />