How to redirect to Hydrogen's route when successfully login in admin Shopify #2503
Replies: 2 comments
-
No, it's no possible to redirect back after signing in to the Shopify admin. One suggestion is to replicate the logic of the authenticated |
Beta Was this translation helpful? Give feedback.
-
I have a solution for returning to a specific Hydrogen page after a successful admin login. You can achieve this by modifying the code in the admin.server.tsx file. Assuming you have a Hydrogen page with the path hydrogen_domain/setting_abc, you can redirect the user to this page after a successful admin login by adding a redirect statement to the code. Here's an example of how you can modify the code in admin.server.tsx: // Import the necessary modules // ...existing code... // Inside your login function or where the login success condition is checked // ...existing code... By using the Redirect component from the @hydrogenjs/router package, you can specify the desired path (/setting_abc in this example) to which the user will be redirected after a successful login. Make sure to update the path hydrogen_domain/setting_abc to match the actual path of your desired Hydrogen page. I did the same practice for my Shopify Store. Remember to rebuild and deploy your Hydrogen application for the changes to take effect. |
Beta Was this translation helpful? Give feedback.
-
hi team,
By default, Hydrogen provides the feature to enter the admin
with path: hydrogen_domain/admin
(https://github.com/Shopify/hydrogen-v1/blob/v1.x-2022-07/templates/demo-store/src/routes/admin.server.tsx#L25)
We want after successful admin login to return to a Hydrogen page. Eg: hydrogen_domain/setting_abc page
Is there any solution for this ?
Thanks
Hau Nguyen
Beta Was this translation helpful? Give feedback.
All reactions