'Nuxt js Router Push Not Working After Delete

I've created a simple CRUD with Nuxt. Data is provided by Lumen. I got a problem with the DELETE, data is deleted but Nuxt does not redirect to the other page.

Here is my script:

<script>
export default {
  name: 'EmployeePage',
  data() {
    return {
      fields: ['name','email','image','address'],
      emplyees:[],
    }
  },
  mounted() {
    this.$axios.get('/employee').then(response => {
      this.pegawais = response.data.data
    }).catch(error => {
      console.log(error.response.data)
    })
  },
  methods: {
    async delete(id) {
      await this.$axios.delete(`/employee/${id}`).then(response => {
        this.$router.push({ name: 'employee' })   <-----this redirect not working
      })
    }
  }
}
</script>

I want Nuxt to redirect to the employee page that display all the data after the deletion.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source