let that = this window.addEventListener("beforeunload", function(event) { event.preventDefault(); // problem line that.$store.dispatch('CURR_TERMINAL_ACTION', that.id) })