You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using Vue, Intertiajs and Laravel. In your documentation you say:
When making a non-GET Inertia request manually or via a <Link> element, you should ensure that you
always respond with a proper Inertia redirect response.
class UsersController extends Controller
{
public function index()
{
return Inertia::render('Users/Index', [
'users' => User::all(),
]);
}
public function store(Request $request)
{
User::create(
$request->validate([
'name' => ['required', 'max:50'],
'email' => ['required', 'max:50', 'email'],
])
);
return to_route('users.index');
}
}
But if i do that I lose the query params that were on the original URL. So i my case I have query params for pagination and table filters. Using the to_route() method means everything on the frontend gets reset.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hey
I am using Vue, Intertiajs and Laravel. In your documentation you say:
But if i do that I lose the query params that were on the original URL. So i my case I have query params for pagination and table filters. Using the
to_route()
method means everything on the frontend gets reset.In laravel we can do:
This seems to work and will maintain the query params, but its not an Inertiajs response, so I assume the page props may not update correctly?
What is the correct way to handle this scenerio.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions