Skip to content

Commit

Permalink
Redirect player url without slug
Browse files Browse the repository at this point in the history
  • Loading branch information
reneklacan committed Feb 15, 2024
1 parent 50c8957 commit 5c7a4d7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/pages/players/[id].astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
export const prerender = false
import { PlayersApi } from "../../lib/api"
import { getDataOrErrorResponse } from "../../lib/utils"
import { urlencode } from "../../lib/utils"
const playerId = Astro.params.id!
const [[player], error] = await getDataOrErrorResponse(PlayersApi.getPlayer({ playerId }))
if (error) return error
return Astro.redirect(`/players/${player.id}-${urlencode(player.nickname)}`)
---

0 comments on commit 5c7a4d7

Please sign in to comment.