0

Routes in main.js

{
    name: 'match',
    path: '/match/:id',
    component: Match,
    props: true
},

And in the main component (separate file) that fires the GET request:

axios({
      method: "GET",
      url: "/match/" + id,
      crossdomain: true,

)}

Chrome tells me it's a 404. But when I open the provided link, it resolves and works?

enter image description here

2 Answers 2

1

You should try

this.$router.push("/match/" + id)

While 'this' is a Vue instance. You need to use vue-router API to navigate inside your application, not axois.

Sign up to request clarification or add additional context in comments.

Comments

0

Solved by changing component Axios call to

url: this.$router.push({ name: 'match', params: { id: id }})

As per https://router.vuejs.org/guide/essentials/named-routes.html

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.