Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

231
Views
How to Redirect to component with Middleware in Nuxt js

I have this structure:

components
    Login.vue
layouts
    default.vue
middleware
    authenticated.js
Pages
    index.vue

Is there somethin form that Redirect to the Login component from middleware/authenticated.js?

I have this code in default.vue, from where I do the Login.vue import.

<template>
  <v-app dark>
    <div v-if="$auth.loggedIn" >...
      <!-- Contenido del Main -->
      <v-main>
        <v-container>
          <nuxt />
        </v-container>
      </v-main>
    </div> 
    <div v-else>
      <!-- Page Login Component-->
      <Login />
    </div>
  </v-app>
</template>
<script>
import Login from "~/components/Login"
export default {
components: {
    Login,
  },
}
</script>

I don't have this idea, because in the page They use it like this

 if (!store.state.authenticated) {
    return redirect('/login')
  }

could someone explain to me?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!