import { SET_BUNDLE_PRODUCTS_FILTER } from '@/store/utils/types'
import router from '@/router'

export default store => {
  store.subscribe(async mutation => {
    if (['myBundle/' + SET_BUNDLE_PRODUCTS_FILTER].indexOf(mutation.type) !== -1) {
      let pagination = store.getters.getPagination('myBundle-products') || { offset: 0 }
      if (pagination.offset !== 0) {
        router.push({ name: 'MyBundleSelectProduct', params: { page: 1 } })
      }
    }
  })
}
