Home Posts GitHub Menu

Vue Auth Recipes Using Ready and Load

The ready and load methods are helpful with letting us know the current state of our authentication and user.

When a user logs in it will fetch a token and a user then redirect. But what happens if we refresh the page? We need some way to know if the token is proper and the user has been loaded.

This is where using ready and load can be useful.


The ready method returns a reactive property that tells us when we can proceed.

    We have checked the token and loaded the user.



Typically this would be used for a load screen and it may interact with other pre-load checks.



    export default {
        computed: {
            loaded() {
                return (
                    this.$auth.ready() &&

        mounted() {
                .then(() => {
                    // fetch some user app data.
                    // ex: notifications