From ca5cb638b8d24d579c66aecefc2eee163374b7c2 Mon Sep 17 00:00:00 2001 From: Alec LaLonde Date: Mon, 15 Feb 2021 20:46:17 -0700 Subject: [PATCH] Make username params lowercase to match those in the database --- packages/web/pages/player/[username].tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/web/pages/player/[username].tsx b/packages/web/pages/player/[username].tsx index 9083196c..7f74de83 100644 --- a/packages/web/pages/player/[username].tsx +++ b/packages/web/pages/player/[username].tsx @@ -9,7 +9,7 @@ import { } from 'next'; import Error from 'next/error'; import { useRouter } from 'next/router'; -import React from 'react'; +import React, { useState } from 'react'; import { PageContainer } from '../../components/Container'; import { PlayerAchievements } from '../../components/Player/Section/PlayerAchievements'; @@ -30,10 +30,10 @@ const PlayerPage: React.FC = ({ player }) => { PLAYER_MEMBERSHIPS: 'Memberships', PLAYER_ACHIEVEMENTS: 'Achievements', }; - const [boxAvailableList, setBoxAvailableList] = React.useState([]); - const [canEdit] = React.useState(false); + const [boxAvailableList, setBoxAvailableList] = useState([]); + const [canEdit] = useState(false); - const [fakeData, setFakeData] = React.useState([ + const [fakeData, setFakeData] = useState([ [], [BOX_TYPE.PLAYER_MEMBERSHIPS, BOX_TYPE.PLAYER_SKILLS], [BOX_TYPE.PLAYER_GALLERY], @@ -180,7 +180,9 @@ export const getStaticPaths: GetStaticPaths = async () => { export const getStaticProps = async ( context: GetStaticPropsContext, ) => { - const username = context.params?.username; + // usernames in the DB are lowercase. This essentially + // makes this page's router variable case-insensitive. + const username = context.params?.username?.toLowerCase(); const player = await getPlayer(username); return {