[Vuejs]-Vue watch still fires vuex action after updating vuex state

0👍

I have solved this by adding if else statement inside the click event to check the isLoggedIn state value

const actions = {
    preventClickingItems: ( {commit, state} ) => {
        $('section').on('click', 'div.container *', (e) => {
            if ( state.isLoggedIn ) {
                return
            }
            else {
                $('#modals-signup').modal('show')
                e.preventDefault()
                e.stopPropagation()
                return false
            }
        })
    }
}

Leave a comment