You cannot; these are not the same techniques - with axios you are making an asynchronous request (there was an earlier request to load the page), whereas the Inertia approach is a single page application which needs the query params to fetch the relevant data in the same visit.
Aug 29, 2022
3
Level 63
How to hide params from the URL with an InertiaJS get request ?
Hello,
Without InertiaJS, I had this code.
axios.get('/api/students', { params: { levelId: this.levelId } })
With InertiaJS, I have this code.
Inertia.visit(route('prices.index'), {
preserveState: true,
data: { levelId: this.levelId },
only: ['prices']
}, { replace: true })
With the axios query, the URL remains : http://localhost:8000/prices but with InertiaJS, the URL is updated to http://localhost:8000/prices?levelId=2.
I'd like to hide the params from the URL.
How is it possible to do that with InertiaJS with a GET request ? (like with axios)
Thanks for your help.
Vincent
Level 104
2 likes
Please or to participate in this conversation.