open-saas
open-saas copied to clipboard
Redirect logged-in users from /login and /signup to /demo-app
Description
Logged-in users accessing /login or /signup are now redirected to /demo-app using useNavigate from react-router-dom.
Changes:
-
LoginPage.tsx & SignupPage.tsx: Added
useEffecthook that checks auth status viauseAuth()and redirects when user is present - authRedirectTests.spec.ts: E2e tests verifying redirect behavior for both routes
const { data: user } = useAuth();
const navigate = useNavigate();
useEffect(() => {
if (user) {
navigate("/demo-app");
}
}, [user, navigate]);
Contributor Checklist
- [x] Update e2e tests: If you changed the /template/app, then make sure to do any neccessary updates to /template/e2e-tests also.
- [ ] Update demo app: If you changed the /template/app, then make sure to do any neccessary updates to /opensaas-sh/app_diff also. Check /opensaas-sh/README.md for details.
- [ ] Update docs: If needed, update the /opensaas-sh/blog/src/content/docs.
Original prompt
This section details on the original issue you should resolve
<issue_title>redirect from /login and /signup to /demo-app if logged in</issue_title> <issue_description>use
useNavigatefromreact-router-dom</issue_description>Comments on the Issue (you are @copilot in this section)
- Fixes wasp-lang/open-saas#475
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.