Koha/koha-tmpl/intranet-tmpl/prog/js/vue
Jonathan Druart a294c5e901
Bug 32898: ERM - Improve fetch
... and fix cypress tests

The main problem was that there were no more checkError call for fetchLocalTitleCount
and the error was not displayed on the UI.

This commit is doing several things:
- Refactor fetch.js to call the same fetch method (myFetch) in order to
deal with the error in a single place
- Have a new myFetchTotal JS function to get the X-Total-Count header
from the response and get the benefit of the previous refactoring
- Rename fetchCountLocalPackages with fetchLocalPackagesCount to match fetchLocalTitleCount
- Use fetchLocalPackagesCount on the Package list view
- Use checkError from components using fetch directly. Ideally the could
should be moved to fetch.js and myFetch should be used.
- checkError get a new flag in parameter to ask for the response instead
of the result (ie. the JSON of the response). That's useful when we need
the response status or the headers
- Make checkError throw a proper exception to stop propation. This
modify the error we display on the UI, it's why we have the following
changes in cypress tests:
-            "Something went wrong: Internal Server Error"
+            "Something went wrong: Error: Internal Server Error"
That's not ideal, we should have our own JS exception to avoid that
"Error" (coming from the toString call on the error)

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-02-21 09:10:14 -03:00
..
components/ERM Bug 32898: ERM - Improve fetch 2023-02-21 09:10:14 -03:00
composables Bug 32030: Filter by expired agreements 2022-11-08 09:44:21 -03:00
stores Bug 32030: Add lib for agreement's relationships values 2022-11-08 09:44:52 -03:00
fetch.js Bug 32898: ERM - Improve fetch 2023-02-21 09:10:14 -03:00
main-erm.ts Bug 32030: Remove unnecessary landing pages 2022-11-08 09:44:42 -03:00
messages.js Bug 32030: Add warning to Dialog 2022-11-08 09:44:15 -03:00
routes.js Bug 32147: Capitalization: E-Resource management 2022-11-16 08:46:20 -03:00
vue-shims.d.ts