Skip to content

Commit 82a4b23

Browse files
update routing reliability for profile pages
1 parent 29502f3 commit 82a4b23

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

app/player-management/page.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ export default function PlayerManagement() {
661661
/>
662662
<input
663663
type="text"
664-
placeholder="Last Name"
664+
placeholder="Last Name (If middle name or multi-word last name, include here)"
665665
value={newPlayer.lastName}
666666
onChange={(e) =>
667667
setNewPlayer({ ...newPlayer, lastName: e.target.value })

app/profile/[playerId]/page.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,15 @@ async function getPlayerData(playerId) {
4141
return null
4242
}
4343

44+
console.log(playerId)
4445
// Find player by matching the cleaned versions of first and last names
45-
const [firstName, lastName] = playerId.split('-')
46+
// Assume Multi-word names include middle/multiword last names in last name
47+
const [firstName, ...lastNameParts] = playerId.split('-')
48+
const lastName = lastNameParts.join('-')
4649
const targetPlayer = mensTeam.players.find(
4750
(player) =>
48-
cleanString(player.firstName) === firstName &&
49-
cleanString(player.lastName) === lastName
51+
cleanString(player.firstName) === cleanString(firstName) &&
52+
cleanString(player.lastName) === cleanString(lastName)
5053
)
5154

5255
if (!targetPlayer) {

0 commit comments

Comments
 (0)