Skip to content
Discussion options

You must be logged in to vote

Hey! You can do this like this:

import { router } from '@inertiajs/vue3'

router.on('before', (event) => {
  event.detail.visit.data.foo = 'bar'
})

But I would discourage doing this, as for GET requests this is going to end up being /endpoint?foo=bar, and for POST/PUT/PATCH it will be part of the body.

I think it's better to send a header instead:

import { router } from '@inertiajs/vue3'

router.on('before', (event) => {
  event.detail.visit.headers.foo = 'bar'
})

Hope that helps.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@sarik-k
Comment options

Answer selected by sarik-k
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants