Koha/koha-tmpl/intranet-tmpl/prog/js/vue/messages.js
Jonathan Druart 5d8c6a36b8
Bug 32983: ERM - Retrieve AVs from an endpoint
Bug 32981 let us retrieve the authorised values from a REST API route,
instead of injecting them from the template. Let us that for the ERM module!

Test plan:
You will notice a "Loading" screen when refreshing the ERM module
Then you should not notice any other UI changes. Dropdown list should be
populated like before this patch.

Some technical notes:
I am expecting this to be slower than before, but it feels better to use
a REST API route to retrieve the AV
Future improvement will be to lazy load the AVs, to speed up the landing
page. However it needs more changes, and this gets big enough.
I would like to see a follow-up that move the code from ERM/Main.vue to
the authorised value store (I've failed at that), but that should
certainly be done after the lazy loading is implemented anyway)

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-03-02 14:46:09 -03:00

44 lines
No EOL
1.2 KiB
JavaScript

import { useMainStore } from "./stores/main";
export const setError = function (new_error) {
const mainStore = useMainStore();
const { setError } = mainStore;
setError("Something went wrong: " + new_error);
};
export const setWarning = function (new_warning) {
const mainStore = useMainStore();
const { setWarning } = mainStore;
setWarning(new_warning);
};
export const setMessage = function (message) {
const mainStore = useMainStore();
const { setMessage } = mainStore;
setMessage(message);
};
export const removeMessages = function () {
const mainStore = useMainStore();
const { removeMessages } = mainStore;
removeMessages();
};
export const submitting = function () {
const mainStore = useMainStore();
const { submitting } = mainStore;
submitting();
};
export const submitted = function () {
const mainStore = useMainStore();
const { submitted } = mainStore;
submitted();
};
export const loading = function () {
const mainStore = useMainStore();
const { loading } = mainStore;
loading();
};
export const loaded = function () {
const mainStore = useMainStore();
const { loaded } = mainStore;
loaded();
};