Helper methods refactoring

This commit is contained in:
Peter Papp
2021-05-11 07:27:26 +02:00
parent ca255a7416
commit 9857a30d2c
10 changed files with 258 additions and 273 deletions

View File

@@ -7,28 +7,11 @@ import axios from 'axios'
const Helpers = {
install(Vue) {
Vue.prototype.$searchInvoices = debounce(function (value) {
Vue.prototype.$showSidebarPreview = function (entry) {
this.$store.commit('ADD_ITEM_TO_CLIPBOARD', entry)
if (value !== '' && typeof value !== 'undefined') {
if (['regular-invoice', 'advance-invoice'].includes(this.$store.getters.currentFolder.location)) {
this.$store.dispatch('getSearchResultForInvoices', value)
} else {
this.$store.dispatch('getSearchResultForClients', value)
}
} else if (typeof value !== 'undefined') {
let locations = {
'regular-invoice': 'getRegularInvoices',
'advance-invoice': 'getAdvanceInvoices',
'clients': 'getClients',
}
this.$store.dispatch(locations[this.$store.getters.currentFolder.location])
this.$store.commit('CHANGE_SEARCHING_STATE', false)
}
}, 300)
this.$store.dispatch('fileInfoToggle', true)
}
Vue.prototype.$renameFileOrFolder = function (entry) {
events.$emit('popup:open', {name: 'rename-item', item: entry})