Skip to content

Commit

Permalink
Merge pull request #51 from ystv/WEB-117-readable-urls
Browse files Browse the repository at this point in the history
WEB-117: Change team path to emailAlias
  • Loading branch information
rmil authored Oct 3, 2022
2 parents a1c19f0 + 0bd844a commit 29967d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pages/about/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function About({ teams }: Teams) {
{teams.map((team, i) => {
return (
<div key={`committeemid${i}`}>
<Link href={`/about/team/${team.id}`}>
<Link href={`/about/team/${team.emailAlias}`}>
<a>
<h3 style={{ textTransform: "capitalize" }}>{team.name}</h3>
</a>
Expand Down
10 changes: 5 additions & 5 deletions pages/about/team/[teamID].tsx → pages/about/team/[name].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ export default function TeamID({ team }: Props) {
<p>{team.longDescription}</p>
<br />
<h2>Team Members:</h2>
{team.members?.map((e, i) => {
{team.members?.map((member, i) => {
return (
<Fragment key={`member${i}`}>
<h3>
{e.officerName} - {e.userName}
{member.officerName} - {member.userName}
</h3>
<span>
<a
href={`mailto:${e.emailAlias}@ystv.co.uk`}
>{`${e.emailAlias}@ystv.co.uk`}</a>
href={`mailto:${member.emailAlias}@ystv.co.uk`}
>{`${member.emailAlias}@ystv.co.uk`}</a>
</span>
</Fragment>
);
Expand All @@ -40,7 +40,7 @@ export default function TeamID({ team }: Props) {
export async function getServerSideProps(context) {
try {
let res = await fetch(
`${process.env.REST_API}/v1/public/teams/${context.query.teamID}`
`${process.env.REST_API}/v1/public/teams/${context.query.name}`
).then((res) => {
if (!res.ok) {
context.res.statusCode = 302;
Expand Down

0 comments on commit 29967d6

Please sign in to comment.