Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. async filterData({target}, id, type) {
  2.       const keyinFilters = this.filters.find(filter => filter.id == id)
  3.       if (keyinFilters) {
  4.         const index = this.filters.findIndex(filter => filter.id == id)
  5.         this.filters.splice(index, 1)
  6.       }
  7.       if (target.value) {
  8.         this.filters.push({
  9.           id,
  10.           key: type === 'string' || type == 'text' ? `filter[${id}][like]` : `filter[${id}]`,
  11.           value: target.value,
  12.           type
  13.         })
  14.       }
  15.  
  16.       const query = new URLSearchParams()
  17.      
  18.       this.filters.forEach(filter => query.append(filter.key, filter.value))
  19.       this.$store.dispatch('fetchData', query)
  20.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement