Redirect to another route with data #2438
-
I have an route /account which is only accessible when logged-in. If an user isn't authenticated this happens:
What i wan't is the redirect to send some information like { isLoggedIn: false } to the home component. This way i can show a toast that says "Unauthrized access" for a few seconds. Is this achievable with Shopify - Hydrogen? Can't find it in the documentation. |
Beta Was this translation helpful? Give feedback.
Answered by
juanpprieto
Jan 18, 2023
Replies: 1 comment 2 replies
-
Hi, you could try passing a query param and then check for it on the Home route to determine wether to show the toast or not // Redirect to login if no custom access token found
if (!customerAccessToken) return response.redirect('/?isLoggedIn=false'); // renders Home component |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
Makxzod
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, you could try passing a query param and then check for it on the Home route to determine wether to show the toast or not