Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

154
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda