I want to redirect to another page when I call a function inside the Vue script.
Has anyone here done this before?
This is what I tried but it's not working as I'm expecting it to work.
<script setup>
const handleClick = () => {
router.visit(route("my-route-here"), {
method: "get",
});
};
</scritp>
I know that there's Inerita's Link but I can't use it because the element that is being clicked doesn't always need to redirect to the route.
EDIT:
The redirect is working now. But the problem is, that the query parameters aren't added in the URL.
<script setup>
const handleClick = () => {
router.visit(route("my-route-here"), {
method: "get",
data: {
foo: 'bar',
},
});
};
</scritp>
What I'm expected above is, that the foo is appended to the URL of route("my-route-here").