how do you check if an object in mapstate is not empty?

mapState should be in computed section and not in methods:

  computed: {
        ...mapState(['bankData']),
  },
  methods: {
    request () {
            // now this.bankData is an object from a state and not a mapState function
            if (this.bankData) {
                return this.$router.push({ name: 'payment.request' })
            }
            this.$root.$emit('openModal')
        }
  }

As for checking an objects is empty or not, for instance, see this answer

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top