[Vuejs]-How to make sure Vue component doesn't show

1๐Ÿ‘

โœ…

Add this.showComponent to else:

beforeCreate() {
    this.showComponent= false;
    s_auth.get(false, true).then(response => {
        if (response.role.name === 'MANAGER') {
            this.$router.push('/recipe-manager');
        } else if (response.role.name === 'CLIENT') {
            this.$router.push('/client');
        } else if (response.role.name === 'JOE') {
            this.$router.push('/joe');
        } else { // add else here to change showComponent value when there is no route change
            this.showComponent = true
        }
    })
}
๐Ÿ‘คAlireza HI

Leave a comment