title: Nuxt middleware creating infinite redirects
body: <p>I have a middleware which checks at what step of registration the user is in and based on that I redirect user to appropiate page. Here is my middleware code:</p>
  
  <pre><code>export default function ({app, redirect, route}) {
      let auth = app.$auth;
      console.log('step checks middleware');
  
      if(auth.loggedIn) {
          console.log('[StepChecks Middleware][Info] User logged in');
          console.log(`[StepChecks Middleware][Info] User step completed ${auth.user.step_completed}`);
  
          if(auth.user.step_completed === '1') {
              console.log(`[StepChecks Middleware][Info] Should be redirected to '/registration/2'`);
              if(route.fullPath === '/registration/2') {
                  console.log(`[StepChecks Middleware][Info] Routing to /registration/2. No redirect.`);
              } else {
                  console.log(`[StepChecks Middleware][Info] Should be redirected to /registration/2.`);
                  return redirect('/registration/2');
              }
          }
  
          if(auth.user.step_completed === '3') {
              console.log(`[StepChecks Middleware][Info] Should be redirected to '/registration/3'`);
              if(route.fullPath === '/registration/3') {
                  console.log(`[StepChecks Middleware][Info] Routing to /registration/3. No redirect.`);
              } else {
                  console.log(`[StepChecks Middleware][Info] Should be redirected to /registration/3.`);
                  return redirect('/registration/3');
              }
          }
  
      }
  }
  </code></pre>
  
  <p>But this is creating a infinite loop of redirection.</p>
  
  <p><strong>Output</strong></p>
  
  <pre><code>================= Step checks middleware ==================  
  [StepChecks Middleware][Info] User logged in  
  [StepChecks Middleware][Info] User step completed 1  
  [StepChecks Middleware][Info] Should be redirected to '/registration/2'  
  [StepChecks Middleware][Info] Should be redirected to /registration/2.  
    nuxt:render Rendering url /registration/2 +2s  
  Making request to /api/me  
  Making request to /api/web/interest_categories  
  ================= Step checks middleware ==================  
  [StepChecks Middleware][Info] User logged in  
  [StepChecks Middleware][Info] User step completed 1  
  [StepChecks Middleware][Info] Should be redirected to '/registration/2'  
  [StepChecks Middleware][Info] Routing to /registration/2. No redirect.  
    nuxt:render Rendering url / +1s  
  Making request to /api/me  
  Making request to /api/web/interest_categories  
  ================= Step checks middleware ==================  
  [StepChecks Middleware][Info] User logged in  
  [StepChecks Middleware][Info] User step completed 1  
  [StepChecks Middleware][Info] Should be redirected to '/registration/2'  
  [StepChecks Middleware][Info] Should be redirected to /registration/2.  
    nuxt:render Rendering url /registration/2 +1s  
  Making request to /api/me  
  Making request to /api/web/interest_categories  
  ================= Step checks middleware ==================  
  [StepChecks Middleware][Info] User logged in  
  [StepChecks Middleware][Info] User step completed 1  
  [StepChecks Middleware][Info] Should be redirected to '/registration/2'  
  [StepChecks Middleware][Info] Routing to /registration/2. No redirect.  
    nuxt:render Rendering url / +1s  
  Making request to /api/me  
  Making request to /api/web/interest_categories  
  ================= Step checks middleware ==================  
  [StepChecks Middleware][Info] User logged in  
  [StepChecks Middleware][Info] User step completed 1  
  [StepChecks Middleware][Info] Should be redirected to '/registration/2'  
  [StepChecks Middleware][Info] Should be redirected to /registration/2.  
    nuxt:render Rendering url /registration/2 +1s  
  Making request to /api/me  
  Making request to /api/web/interest_categories  
  ================= Step checks middleware ==================  
  [StepChecks Middleware][Info] User logged in  
  [StepChecks Middleware][Info] User step completed 1  
  [StepChecks Middleware][Info] Should be redirected to '/registration/2'  
  [StepChecks Middleware][Info] Routing to /registration/2. No redirect.  
    nuxt:render Rendering url / +1s  
  Making request to /api/me  
  Making request to /api/web/interest_categories  
  ================= Step checks middleware ==================  
  [StepChecks Middleware][Info] User logged in  
  [StepChecks Middleware][Info] User step completed 1  
  [StepChecks Middleware][Info] Should be redirected to '/registration/2'  
  [StepChecks Middleware][Info] Should be redirected to /registration/2.  
    nuxt:render Rendering url /registration/2 +1s  
  Making request to /api/me  
  Making request to /api/web/interest_categories  
  ================= Step checks middleware ==================  
  [StepChecks Middleware][Info] User logged in  
  [StepChecks Middleware][Info] User step completed 1  
  [StepChecks Middleware][Info] Should be redirected to '/registration/2'  
  [StepChecks Middleware][Info] Routing to /registration/2. No redirect.  
    nuxt:render Rendering url / +1s  
  Making request to /api/me  
  Making request to /api/web/interest_categories  
  ================= Step checks middleware ==================  
  [StepChecks Middleware][Info] User logged in  
  [StepChecks Middleware][Info] User step completed 1  
  [StepChecks Middleware][Info] Should be redirected to '/registration/2'  
  [StepChecks Middleware][Info] Should be redirected to /registration/2.  
    nuxt:render Rendering url /registration/2 +1s  
  Making request to /api/me  
  Making request to /api/web/interest_categories  
  ================= Step checks middleware ==================  
  [StepChecks Middleware][Info] User logged in  
  [StepChecks Middleware][Info] User step completed 1  
  [StepChecks Middleware][Info] Should be redirected to '/registration/2'  
  [StepChecks Middleware][Info] Routing to /registration/2. No redirect.  
  </code></pre>
  
  <p>And this goes on. I can not figure out why this issues is happening. Initailly I did not have a check for the current path check <code>if(route.fullPath === '/registration/2')</code>, in that case rest of the pages were working fine but navigated to <code>/registration/2</code> from registration page it was creating infinite loop of redirection. </p>