1

I am using laravel 5.8 and Vuejs2 How to prevent disappear edit id from router param when refresh page

This is my router link

<router-link :to="{ name: 'editEmployee', params: { id:employee.id } }" 
 title="Edit">
      Edit
  </router-link>

and this is my defined route

{ path: '/editemployee', component: require('./components/EditEmployee.vue').default, name: 'editEmployee',meta: {title: 'Edit Employee' } },

And this is how am checking param id in editEmployee component

created() {
 if (this.$route.params.id) {
   this.editMode = true;
   this.loadUser(this.$route.params.id);
 }
}

But when i refresh page the param id is disappearing from route. how can i prevent disappearing id from route when i refresh page

Anyone can help me? thanks in advance.

1 Answer 1

1

You forgot to include the id param in your route

path: '/editemployee/:id'
Sign up to request clarification or add additional context in comments.

1 Comment

got it. Thank you

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.