title: nuxt axios onError unathenticated logout then redirect
body: <p>my backend in laravel and i set if user login to another device then current device auth token is invalid </p>
  
  <p>i also want if he get unathenticated error 401 in axios then instant logout and redirect to login page</p>
  
  <p>i am doing like this</p>
  
  <pre><code>export default function({ $axios, redirect, $auth }) {
    $axios.onError(error =&gt; {
      if (error.response.status === 401) {
        if ($auth.loggedIn) {
          $auth.logout();
        }
        redirect("/login");
      }
    });
  }
  </code></pre>
  
  <p>but nothing happen and when i check <code>console.log($auth)</code> its getting <code>undefine</code></p>
  
  <p>Help me thank you</p>