Bug 32991: accept is a callback, rename accept to accept_callback

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Agustín Moyano <agustinmoyano@theke.io>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Pedro Amorim 2023-02-24 17:10:03 +00:00 committed by Tomas Cohen Arazi
parent 46a72d54a0
commit 5ceccfe0ad
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
2 changed files with 13 additions and 13 deletions

View file

@ -12,10 +12,10 @@
<div class="dialog alert confirmation">
<h1 v-html="confirmation"></h1>
<button
v-if="accept"
v-if="accept_callback"
id="accept_modal"
class="approve"
@click="accept"
@click="accept_callback"
>
<i class="fa fa-fw fa-check"></i>
{{ $__("Accept") }}
@ -47,7 +47,7 @@ export default {
error,
warning,
confirmation,
accept,
accept_callback,
is_submitting,
is_loading,
} = storeToRefs(mainStore)
@ -57,7 +57,7 @@ export default {
error,
warning,
confirmation,
accept,
accept_callback,
is_submitting,
is_loading,
removeMessages,

View file

@ -6,7 +6,7 @@ export const useMainStore = defineStore("main", {
_error: null,
_warning: null,
_confirmation: null,
_accept: null,
_accept_callback: null,
previousMessage: null,
previousError: null,
displayed_already: false,
@ -28,17 +28,17 @@ export const useMainStore = defineStore("main", {
this._confirmation = null;
this.displayed_already = displayed; /* Is displayed on the current view */
},
setWarning(warning, accept, displayed = true) {
setWarning(warning, displayed = true) {
this._error = null;
this._warning = warning;
this._message = null;
this._confirmation = null;
this.displayed_already = displayed; /* Is displayed on the current view */
},
setConfirmation(confirmation, accept, displayed = true){
if(accept) {
this._accept = async () => {
await accept()
setConfirmation(confirmation, accept_callback, displayed = true){
if(accept_callback) {
this._accept_callback = async () => {
await accept_callback()
this.removeMessages()
}
}
@ -54,7 +54,7 @@ export const useMainStore = defineStore("main", {
this._warning = null;
this._message = null;
this._confirmation = null;
this._accept = null;
this._accept_callback = null;
}
this.displayed_already = true;
},
@ -84,8 +84,8 @@ export const useMainStore = defineStore("main", {
confirmation() {
return this._confirmation
},
accept() {
return this._accept
accept_callback() {
return this._accept_callback
},
is_submitting(){
return this._is_submitting