From 4b960308d4de945aa0a06e569559c12066ab9ae1 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sat, 19 Nov 2022 20:53:09 -0800 Subject: [PATCH] Continue fixing linter errors --- components/GridRep/index.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/components/GridRep/index.tsx b/components/GridRep/index.tsx index cc8a1ee0..ff9fe507 100644 --- a/components/GridRep/index.tsx +++ b/components/GridRep/index.tsx @@ -95,11 +95,14 @@ const GridRep = (props: Props) => { function generateGridImage(position: number) { let url = "" - if (weapons[position] && grid[position]) { - if (weapons[position]?.element == 0 && grid[position]?.element) { - url = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/weapon-grid/${weapons[position]?.granblue_id}_${grid[position].element}.jpg` + const weapon = weapons[position] + const gridWeapon = grid[position] + + if (weapon && gridWeapon) { + if (weapon.element == 0 && gridWeapon.element) { + url = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/weapon-grid/${weapon.granblue_id}_${gridWeapon.element}.jpg` } else { - url = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/weapon-grid/${weapons[position]?.granblue_id}.jpg` + url = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/weapon-grid/${weapon.granblue_id}.jpg` } }