Koha/koha-tmpl/intranet-tmpl/prog/js/vue/stores/main.js
Jonathan Druart 228b9ec2e9
Bug 32925: Rename isSubmitting with submitting
Asking to do somthing, not asking if it's being done

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-02-27 11:14:12 -03:00

45 lines
1.3 KiB
JavaScript

import { defineStore } from "pinia";
export const useMainStore = defineStore("main", {
state: () => ({
message: null,
error: null,
warning: null,
previousMessage: null,
previousError: null,
displayed_already: false,
is_submitting: false,
}),
actions: {
setMessage(message) {
this.error = null;
this.warning = null;
this.message = message;
this.displayed_already = false; /* Will be displayed on the next view */
},
setError(error) {
this.error = error;
this.message = null;
this.displayed_already = true; /* Is displayed on the current view */
},
setWarning(warning) {
this.warning = warning;
this.message = null;
this.displayed_already = true; /* Is displayed on the current view */
},
removeMessages() {
if (this.displayed_already) {
this.error = null;
this.warning = null;
this.message = null;
}
this.displayed_already = true;
},
submitting(){
this.is_submitting = true;
},
submitted(){
this.is_submitting = false;
},
},
});