Koha/koha-tmpl/intranet-tmpl/prog/js/vue/stores/main.js
Jonathan Druart 769a1b3477
Bug 32030: Proxy with HoldingsIQ
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:07 -03:00

30 lines
866 B
JavaScript

import { defineStore } from "pinia";
export const useMainStore = defineStore("main", {
state: () => ({
message: null,
error: null,
previousMessage: null,
previousError: null,
displayed_already: false,
}),
actions: {
setMessage(message) {
this.error = 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 */
},
removeMessages() {
if (this.displayed_already) {
this.error = null;
this.message = null;
}
this.displayed_already = true;
},
},
});