Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

148
Vistas
Vue Router - logging out, main app template shows for few seconds along with login component

I have an issue where my main UI is still displayed for a few seconds after clicking a logout button.

As a result the login form component displays momentarily inside the main UI template before going on to display on a blank page.

I have an App.vue file with this set up.

<template>
  <v-app id="app">
    <template v-if="!signedIn">
      <router-view></router-view>
    </template>
    <template v-if="signedIn">   
     // main app UI here ...still shows for a couple of seconds with the login form inside it 
    </template>
</template>

The signedIn value determines if the main app ui is shown or not. It works, but as I say there is a some time where both the main UI and the login form appear in the interface.

I have the following route middleware set up where the userModule.checkUserSignedIn simply gets the current value of signedIn.

function requireAuth(to: TODO, from: TODO, next: TODO) {

      if (!userModule.checkUserSignedIn()) {
        console.log('User not signed in..')
        next({
          path: "/login",
          query: { redirect: to.fullPath }
        });
      } else {
        console.log('User is signed in..')
        next();
      }
    } 
})

The login route is simple.

{ path: "/login", component: Login, name: "Login" }

I am not sure what is causing this to happen and have run into a bit of a dead end. If anyone can help me figure out how to fix this I'd much appreciate it. Thanks in advance!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

i am not really sure about the solution by here are some ideas might help you

  • make sure the default value of signedIn = false
  • use v-if & v-else instead of v-if & v-if

wish you good luck

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda