-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redirect "/list" to "/" when there is no token #25
Conversation
Visit the preview URL for this PR (updated for commit 1d0906b): https://tcl-57-smart-shopping-list--pr25-es-no-token-redirect-k44q2dr8.web.app (expires Mon, 08 May 2023 03:31:54 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: ad3eb6c34c2ec5986fcc218178df5985eb9c9ffb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this, @emilysellers!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Emily! To answer your question, I would vote for doing the same with the Add Item view.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good & thanks!
src/App.jsx
Outdated
<Route | ||
path="/list" | ||
element={listToken ? <List data={data} /> : <Navigate to="/" />} | ||
/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a very useful line of code, @emilysellers. Thank you for doing this extra to make the app more usable. 😁👍🏻
…-shopping-list into es-no-token-redirects-home
Description
This PR fixes the user being able to view the
List
view if they don't yet have a token. Now, if the user doesn't have a token and clicksList
in the nav bar or enters "/list" in the URL bar, theHome
view persists. Once the user creates a new list or enters a token for an existing list, the token is stored in local storage and the user is then able to view theList
view.Something to consider: should the same check be implemented for the
Add Item
view so that if a user doesn't yet have a token, they are not able to navigate to theAdd Item
view?Related Issue
Closes #24
Acceptance Criteria
List
in the nav bar or entering "/list" in the URL bar will keep the user on the home page.Type of Changes
Updates
Before
In this before video, there is no token in local storage. The user clicks the
List
link in the nav bar and is redirected to theList
view.TCL.Issue.14.before.mov
After
In this after video, there is no token in local storage. The user clicks the
List
link in the nav bar and still sees theHome
view, then enters "/list" in the URL bar and still sees theHome
view. The user then clicks theCreate new list
button, the token is saved to local storage and the user is redirected to theList
view.TCL.Issue.14.after.mov
Testing Steps / QA Criteria
List
in the nav bar and check that theHome
view persists.Home
view persists.Create new list
button. Check that a token is saved in local storage and that you're redirected to theList
view.