diff --git a/Vue/vaahtwo/stores/store-modules.js b/Vue/vaahtwo/stores/store-modules.js index 3b5acd93f..0908cade8 100644 --- a/Vue/vaahtwo/stores/store-modules.js +++ b/Vue/vaahtwo/stores/store-modules.js @@ -422,6 +422,7 @@ export const useModuleStore = defineStore({ */ default: options.method = 'PATCH'; + options.callback_params = item.id; ajax_url += '/'+item.id+'/action/'+type; break; } @@ -433,7 +434,7 @@ export const useModuleStore = defineStore({ ); }, //--------------------------------------------------------------------- - async itemActionAfter(data, res) + async itemActionAfter(data, res, item_id = null) { if(data) { @@ -446,14 +447,16 @@ export const useModuleStore = defineStore({ await root.reloadAssets(); await this.formActionAfter(); this.getItemMenu(); - if(data.item){ - await this.resetActivateBtnLoader(this.form.action,data.item); - } + + } + + if(item_id){ + await this.resetActivateBtnLoader(this.form.action,item_id); } }, //--------------------------------------------------------------------- - async resetActivateBtnLoader(action,item) { - let index = this.active_action.indexOf(action+'_'+item.id); + async resetActivateBtnLoader(action,item_id) { + let index = this.active_action.indexOf(action+'_'+item_id); this.active_action.splice(index,1); }, //--------------------------------------------------------------------- diff --git a/Vue/vaahtwo/stores/store-themes.js b/Vue/vaahtwo/stores/store-themes.js index e5bfc5dd6..6deae5fd7 100644 --- a/Vue/vaahtwo/stores/store-themes.js +++ b/Vue/vaahtwo/stores/store-themes.js @@ -422,6 +422,7 @@ export const useThemeStore = defineStore({ */ default: options.method = 'PATCH'; + options.callback_params = item.id; ajax_url += '/'+item.id+'/action/'+type; break; } @@ -433,7 +434,7 @@ export const useThemeStore = defineStore({ ); }, //--------------------------------------------------------------------- - async itemActionAfter(data, res) + async itemActionAfter(data, res, item_id = null) { if (data) { @@ -444,10 +445,10 @@ export const useThemeStore = defineStore({ this.item = data; await root.reloadAssets(); await this.formActionAfter(); - if(data.item){ - await this.resetActivateBtnLoader(this.form.action,data.item) - } + } + if(item_id){ + await this.resetActivateBtnLoader(this.form.action,item_id); } }, //--------------------------------------------------------------------- @@ -489,8 +490,8 @@ export const useThemeStore = defineStore({ } }, //--------------------------------------------------------------------- - async resetActivateBtnLoader(action,item) { - let index = this.active_action.indexOf(action+'_'+item.id); + async resetActivateBtnLoader(action,item_id) { + let index = this.active_action.indexOf(action+'_'+item_id); this.active_action.splice(index,1); }, //--------------------------------------------------------------------- diff --git a/Vue/vaahtwo/vaahvue/pinia/vaah.js b/Vue/vaahtwo/vaahvue/pinia/vaah.js index 25220262c..a71e167c2 100644 --- a/Vue/vaahtwo/vaahvue/pinia/vaah.js +++ b/Vue/vaahtwo/vaahvue/pinia/vaah.js @@ -24,6 +24,7 @@ export const vaah = defineStore({ query: null, headers: null, show_success: true, + callback_params: null, } ) { @@ -33,7 +34,8 @@ export const vaah = defineStore({ method: 'get', query: null, headers: null, - show_toast: true, + show_success: true, + callback_params: null, } if(options) @@ -48,7 +50,8 @@ export const vaah = defineStore({ let method = default_option.method.toLowerCase(); let query = default_option.query; let headers = default_option.headers; - let show_toast = default_option.show_toast; + let show_success = default_option.show_success; + let callback_params = default_option.callback_params; @@ -99,16 +102,16 @@ export const vaah = defineStore({ let ajax = await axios[method](url, params, q) .then(function (response) { self.show_progress_bar = false; - if(show_toast){ + if(show_success){ self.processResponse(response); } if(callback) { if(response.data && response.data.data) { - callback(response.data.data, response); + callback(response.data.data, response,callback_params); } else{ - callback(false, response); + callback(false, response,callback_params); } } return response;