From 060e991741ed87bb938490b6985f74c95c739746 Mon Sep 17 00:00:00 2001 From: Rainnny7 Date: Sun, 21 Apr 2024 23:16:05 -0400 Subject: [PATCH] Unused code --- .../app/(pages)/player/[[...slug]]/page.tsx | 27 ++++++------------- .../app/(pages)/server/[[...slug]]/page.tsx | 27 ++++++------------- 2 files changed, 16 insertions(+), 38 deletions(-) diff --git a/Frontend/src/app/(pages)/player/[[...slug]]/page.tsx b/Frontend/src/app/(pages)/player/[[...slug]]/page.tsx index 2facfcb..6655c46 100644 --- a/Frontend/src/app/(pages)/player/[[...slug]]/page.tsx +++ b/Frontend/src/app/(pages)/player/[[...slug]]/page.tsx @@ -71,7 +71,6 @@ export const generateMetadata = async ({ params, }: PageProps): Promise => { const query: string | undefined = trimQuery(params.slug?.[0]); - let embed: Metadata | undefined; // The player embed, if any if (query) { try { const player: CachedPlayer = await getPlayer(query); // Get the player to embed @@ -81,28 +80,18 @@ export const generateMetadata = async ({ thumbnail: player.skin.parts.HEAD, }); } catch (err) { - const code: number = (err as RestfulMCAPIError).code; // Get the error status code - if (code === 400) { - return Embed({ - title: "Invalid Player", - description: `The player ${query} is invalid.`, - }); - } else if (code === 404) { - return Embed({ - title: "Player Not Found", - description: `The player ${query} was not found.`, - }); - } + return Embed({ + title: "Player Not Found", + description: `The player ${query} was not found.`, + }); } } // Return the page embed - return embed - ? embed - : Embed({ - title: "Player Lookup", - description: "Search for a player to view their profile.", - }); + return Embed({ + title: "Player Lookup", + description: "Search for a player to view their profile.", + }); }; /** diff --git a/Frontend/src/app/(pages)/server/[[...slug]]/page.tsx b/Frontend/src/app/(pages)/server/[[...slug]]/page.tsx index 3ba1dfd..cd11d43 100644 --- a/Frontend/src/app/(pages)/server/[[...slug]]/page.tsx +++ b/Frontend/src/app/(pages)/server/[[...slug]]/page.tsx @@ -91,7 +91,6 @@ export const generateMetadata = async ({ }: PageProps): Promise => { const platform: string | undefined = params.slug?.[0]; // The platform to search for const hostname: string | undefined = params.slug?.[1]; // The hostname of the server to search for - let embed: Metadata | undefined; // The server embed, if any if (platform && hostname) { try { const server: @@ -106,28 +105,18 @@ export const generateMetadata = async ({ thumbnail: (server as CachedJavaMinecraftServer).favicon?.url, }); } catch (err) { - const code: number = (err as RestfulMCAPIError).code; // Get the error status code - if (code === 400) { - return Embed({ - title: "Invalid Platform or Hostname", - description: `The platform ${platform} or hostname ${hostname} is invalid.`, - }); - } else if (code === 404) { - return Embed({ - title: "Server Not Found", - description: `The server ${hostname} was not found.`, - }); - } + return Embed({ + title: "Server Not Found", + description: `The server ${hostname} was not found.`, + }); } } // Return the page embed - return embed - ? embed - : Embed({ - title: "Server Lookup", - description: "Search for a server to view its data.", - }); + return Embed({ + title: "Server Lookup", + description: "Search for a server to view its data.", + }); }; /**