I have a script that will redirect a user to the login screen when they get a response code of 401 - which means their session has expired within the API.

```
import axios from 'axios';

axios.interceptors.response.use(function (response) {
  return response;
}, function(error) {
  if(error.response.status === 401) {
    localStorage.clear();
    window.location = '/';
    return Promise.reject(error);
  }
  return Promise.reject(error)
})

```

I wish to use vue router instead of window.location to redirect to the login page. 

I have tried adding these lines of code to the script:

```
import Vue from 'vue';
Vue.$router.push({ name: 'login' })

```

I get an error.

How would one go about using vue router in this instance?