From 3d87ba7f094a268ab7b60a5a22906b65791f6db6 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 11 Apr 2023 02:08:02 +0000 Subject: [PATCH] Lint Code [skip actions] --- src/handbook/src/backend/server.ts | 15 ++++++--------- src/handbook/src/ui/widgets/ItemCard.tsx | 7 ++++--- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/handbook/src/backend/server.ts b/src/handbook/src/backend/server.ts index de3850c14..f317e73b5 100644 --- a/src/handbook/src/backend/server.ts +++ b/src/handbook/src/backend/server.ts @@ -36,8 +36,7 @@ export async function grantAvatar( talents = 6 ): Promise { // Validate the numbers. - if (invalid(avatar) || invalid(level) - || invalid(constellations) || invalid(talents)) + if (invalid(avatar) || invalid(level) || invalid(constellations) || invalid(talents)) return { status: -1, message: "Invalid arguments." }; return await fetch(`https://localhost:443/handbook/avatar`, { @@ -60,18 +59,16 @@ export async function grantAvatar( * @param item The item's ID. * @param amount The amount of the item to give. */ -export async function giveItem( - item: number, amount = 1 -): Promise { +export async function giveItem(item: number, amount = 1): Promise { // Validate the number. - if (isNaN(amount) || amount < 1) - return { status: -1, message: "Invalid amount." }; + if (isNaN(amount) || amount < 1) return { status: -1, message: "Invalid amount." }; return await fetch(`https://localhost:443/handbook/item`, { - method: "POST", body: JSON.stringify({ + method: "POST", + body: JSON.stringify({ player: targetPlayer.toString(), item: item.toString(), amount }) - }).then(res => res.json()); + }).then((res) => res.json()); } diff --git a/src/handbook/src/ui/widgets/ItemCard.tsx b/src/handbook/src/ui/widgets/ItemCard.tsx index 1408dc1e3..af42dd7fe 100644 --- a/src/handbook/src/ui/widgets/ItemCard.tsx +++ b/src/handbook/src/ui/widgets/ItemCard.tsx @@ -82,9 +82,10 @@ class ItemCard extends React.Component { * @private */ private async addToInventory(): Promise { - await giveItem(this.props.item?.id ?? 102, - typeof(this.state.count) == "string" ? - parseInt(this.state.count) : this.state.count); + await giveItem( + this.props.item?.id ?? 102, + typeof this.state.count == "string" ? parseInt(this.state.count) : this.state.count + ); } componentDidUpdate(prevProps: Readonly, prevState: Readonly, snapshot?: any) {