[Vuejs]-Vue Refresh page execute multiple axios.post

0👍

You can use async/await like so:

async created(){
    await this.validateToken();
    }

This will prevent the create lifecycle hook from completing until the validateToken returns a response

0👍

I am assuming you have a router-view in your App.vue file.
You can keep a flag / variable for your async data and then load the router-view only if that data is available.

<template>
  <router-view v-if="data"></router-view>
</template>

This way, your inner children aren’t even loaded till the time your async data is available.

This answer is just the same comment I made on the question above but for future people to come.

Leave a comment