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 after form success #1222

Closed
olgmaks opened this issue Mar 10, 2024 · 1 comment
Closed

Redirect after form success #1222

olgmaks opened this issue Mar 10, 2024 · 1 comment

Comments

@olgmaks
Copy link

olgmaks commented Mar 10, 2024

I am using turbo with spring boot thymeleaf and java 17
Looking for a way to redirect after successful sign in with full page to be reloaded

Have found this kind of workaround but since it is a workaround maybe there is already more clever way to follow redirect using default turbo frame configuration :

document.addEventListener("turbo:frame-missing", event => {
if (event.detail.response.redirected) {
event.preventDefault()
console.log(event.detail.response);
event.detail.visit(event.detail.response)
}
});

Idea behind my question is that many forms like registration, login, password reset, new Item creation flow are one page forms and user expects fully new page with results after success (with redirect)

turbo-visit-control - reload - does not work as I need since It causes every time full page reload for given page and I only need it once after particular form submitted

Am I missing something from doc?

@pinzonjulian
Copy link

Hey!
You're not missing anything from the docs. It's a feature that's missing but the best implementation hasn't been found just yet.

What I think you're trying to do is to "break out of a frame from the server".

This PR in the Turbo Rails repo has a good discussion about it.

hotwired/turbo-rails#367

A bunch of suggestions for simple workarounds can be found in the latest comments.

@olgmaks olgmaks closed this as completed Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants