Skip to content

Link route election/joel#65

Merged
Joel-leal merged 7 commits intomainfrom
link-route-election/joel
Oct 22, 2024
Merged

Link route election/joel#65
Joel-leal merged 7 commits intomainfrom
link-route-election/joel

Conversation

@Joel-leal
Copy link
Copy Markdown
Contributor

@Joel-leal Joel-leal commented Aug 12, 2024

Description

I added a new route to handle redirection based on an election ID. This route captures the ID from the URL to fetch election details from the database.

Changes

  • Defined a route that takes an election ID from the URL.
  • Redirected the user to a specific page based on the election ID.

Notes

  • In addition to creating the route task, I configured the environment variable.

Board issue

@vercel
Copy link
Copy Markdown

vercel Bot commented Aug 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
voting-system ⬜️ Ignored (Inspect) Oct 21, 2024 7:50pm

@Joel-leal Joel-leal requested a review from frattezi August 12, 2024 18:30
@Joel-leal Joel-leal force-pushed the link-route-election/joel branch from b696123 to e7f9f45 Compare September 12, 2024 14:38
@frattezi frattezi changed the base branch from main to form-election/joel September 12, 2024 14:46
Base automatically changed from form-election/joel to main September 12, 2024 14:47
@frattezi frattezi assigned frattezi and Joel-leal and unassigned frattezi Sep 12, 2024
Comment thread prisma/schema.prisma Outdated
Copy link
Copy Markdown
Contributor

@frattezi frattezi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some minors, but looks good!

Comment thread src/packages/components/HomePage/ElectionForm.tsx Outdated
@frattezi
Copy link
Copy Markdown
Contributor

Remove the route.ts file under src/app/elections/route.ts

Copy link
Copy Markdown
Contributor

@frattezi frattezi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a minor comment

Comment thread src/packages/DAO/elections.dao.ts Outdated
});

revalidatePath("/");
redirect(`http://localhost:3000/elections/${electionId}`);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to setup this as a environment var called APP_BASE_URL as this will change depending on environment.

With the redirect command, in this case here, you can also omit the base url and send only the paths ahead, like:

Suggested change
redirect(`http://localhost:3000/elections/${electionId}`);
redirect(`elections/${electionId}`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for adding the env var as I mentioned if you follow this alternative

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change here 2b69f27

@Joel-leal Joel-leal merged commit cc16270 into main Oct 22, 2024
@Joel-leal Joel-leal deleted the link-route-election/joel branch October 22, 2024 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Redirect user to election after user starts an election in the home page

2 participants