Skip to content

Commit

Permalink
cleanup parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
cmyui committed Jul 7, 2024
1 parent 9e7565a commit 9be7f50
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/pages/ProfilePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ const modeToStatsIndex = (

export const ProfilePage = () => {
const { identity } = useIdentityContext()
const { userId: profileUserId } = useParams()
const queryParams = useParams()

const profileUserId = parseInt(queryParams["userId"] ?? "0")

// TODO: better error handling; each component in the page
// may be able to raise multiple errors; one global one won't cut it
Expand All @@ -59,7 +61,7 @@ export const ProfilePage = () => {
if (!profileUserId) return

try {
const usersResponse = await fetchUser(parseInt(profileUserId))
const usersResponse = await fetchUser(profileUserId)
setUserProfile(usersResponse)
} catch (e: any) {
setError("Failed to fetch user profile data from server")
Expand All @@ -78,7 +80,7 @@ export const ProfilePage = () => {
p: 1, // todo pagination
l: 50,
rx: relaxMode,
id: parseInt(profileUserId),
id: profileUserId,
})
setBestScores(playerBestScores)
} catch (e: any) {
Expand All @@ -98,7 +100,7 @@ export const ProfilePage = () => {
p: 1, // todo pagination
l: 50,
rx: relaxMode,
id: parseInt(profileUserId),
id: profileUserId,
})
setRecentScores(playerRecentScores)
} catch (e: any) {
Expand Down

0 comments on commit 9be7f50

Please sign in to comment.