Skip to content
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 to /dashboard when successfully logged in #8

Merged
merged 2 commits into from
Jun 30, 2024

Conversation

babanesma
Copy link
Contributor

Is your PR related to a specific issue/feature? Please describe and mention issues.

Successful log in was causing an infinite redirection

*[Warning] [Vue Router warn]: Detected an infinite redirection in a navigation guard when going from "/" to "/login". Aborting to avoid a Stack Overflow. This will break in production if not fixed. (vue-router.js, line 43)

Describe alternatives you've considered

Change onGuestOnly to onLogin to redirect logged in users to /dashboard

Additional context

@manchenkoff
Copy link
Owner

manchenkoff commented Jun 30, 2024

Hey @babanesma, thanks for the contribution! Can you please explain a bit more about how you got this warning?
The landing page is supposed to be a page that is available only for guests, but I couldn't reproduce this behavior by logging in. But with your changes, it triggers an infinite redirect problem when you go to the landing page.

@babanesma
Copy link
Contributor Author

@manchenkoff I got this error when I pulled the repo code into my project
On clean install it's not reproduced at all

Although I am still confused on /dashboard because it holds middleware: ['sanctum:auth', 'sanctum:verified'], so it is supposed to be for logged in users only

@manchenkoff
Copy link
Owner

Although I am still confused on /dashboard because it holds middleware: ['sanctum:auth', 'sanctum:verified'], so it is supposed to be for logged in users only

Yes, dashboard page (/dashboard) is only for authenticated users and the landing page (/) for guests only

@manchenkoff manchenkoff added the enhancement New feature or request label Jun 30, 2024
@manchenkoff manchenkoff merged commit 5124124 into manchenkoff:main Jun 30, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants