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

149
Views
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 answers
Answer question

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 Report
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!