Post

@sveltesociety.dev @svelte.dev is this the best way to handle a successful form action that redirects? page.server.ts: redirect(303, `/admin/users/{$userId}?success=true`); I want to show a success message after redirect. Would be nice to not use a URL param.

0 reposts0 likes

Nice example thanks. It's more a pretty alert that lives on the page I'm redirecting too. I'm going to move the form action to the page i want to show the success message, see if that works.

Unfortunately use:enhance doesn't navigate if the action is on a different page (i think it's the only behavior that differ from the browser)...but I think in the redirect case you might be able to determine if you got there through form action by looking at the `form` prop