Koha/koha-tmpl/intranet-tmpl/prog/js/vue/messages.js
Jonathan Druart 1139972748 Bug 33625: Pretty .js files for vue
Test plan:
= Koha =
Apply the first patch, prove xt/vue_tidy.t and notice the failure
Apply this patch, now it passes

= QA test =
Apply the change to the merge request linked with this qa-test-tools' issue:
https://gitlab.com/koha-community/qa-test-tools/-/issues/62
inside your ktd container (at /kohadevbox/qa-test-tools/)
Edit a .js within koha-tmpl/intranet-tmpl/prog/js/vue and a .ts file
(cypress test) with something not pretty
Commit and run the QA script
=> It's failing!
Pretty the change, commit again, run the QA script
=> It's happy!

= KTD - git hook =
Go to the merge request linked with this ktd's issue:
https://gitlab.com/koha-community/koha-testing-docker/-/issues/374
Copy the modified git hook to .git/hooks/ktd/pre-commit
Edit a .js within koha-tmpl/intranet-tmpl/prog/js/vue and a .ts file
(cypress test) with something not pretty
Commit
=> Notice that the commit content is pretty!

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2023-05-16 11:38:04 +02:00

44 lines
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();
};