fix infinite loading icon when searching for an invalid player
All checks were successful
Deploy App / docker (ubuntu-latest) (push) Successful in 1m5s

This commit is contained in:
Lee 2024-04-18 07:59:03 +01:00
parent 0c4a1ebda9
commit 211807f494
4 changed files with 5 additions and 5 deletions

@ -69,7 +69,7 @@ export default async function Page({ params: { id } }: Params): Promise<ReactEle
<h1 className="text-xl">Lookup a Player</h1>
<p>You can enter a players uuid or username to get information about the player.</p>
<LookupPlayer currentPlayer={id[0]} />
<LookupPlayer currentPlayer={id && id[0]} />
</div>
{error && <ErrorCard message={error} />}

@ -124,7 +124,7 @@ export default async function Page({ params: { platform, hostname } }: Params):
<h1 className="text-xl">Lookup a {invalidPlatform ? "" : capitalizeFirstLetter(platform)} Server</h1>
<p>You can enter a server hostname to get information about the server.</p>
<LookupServer currentPlatform={platform.toLowerCase()} currentServer={hostname[0]} />
<LookupServer currentPlatform={platform.toLowerCase()} currentServer={hostname && hostname[0]} />
</div>
{error && <ErrorCard message={error} />}

@ -33,7 +33,7 @@ export function LookupPlayer({ currentPlayer }: PlayerLookupProps): ReactElement
}
// Ignore the same player
if (query.toLowerCase() == currentPlayer.toLowerCase()) {
if (currentPlayer !== undefined && query.toLowerCase() == currentPlayer.toLowerCase()) {
return;
}
@ -49,7 +49,7 @@ export function LookupPlayer({ currentPlayer }: PlayerLookupProps): ReactElement
description: (err as Error).message,
duration: 5000,
});
return;
return setLoading(false);
}
};

@ -57,7 +57,7 @@ export function LookupServer({ currentPlatform, currentServer }: LookupServerPro
description: (err as Error).message,
duration: 5000,
});
return;
return setLoading(false);
}
};