https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36369

--- Comment #40 from Tomás Cohen Arazi (tcohen) <[email protected]> ---
Created attachment 203211
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203211&action=edit
Bug 36369: Introduce KohaApiClient base class

Introduce KohaApiClient as the base class for all API clients. This
class centralizes:
- HttpClient instantiation via a pluggable factory
- The embed parameter: callers declare embeds as an array, and
  _resolveEmbed() translates it to the x-koha-embed HTTP header
- CSRF token injection for state-changing requests (POST/PUT/PATCH/DELETE)

All 26 API client classes now extend KohaApiClient instead of receiving
HttpClient as a constructor argument. All hardcoded x-koha-embed headers
in client methods are replaced with the declarative embed: [...] parameter.

HttpClient gains pluggable lifecycle callbacks (onError, onSubmitting,
onSubmitted) so different environments can provide their own UI feedback.
The Vue apps use VueHttpClient (vue/fetch/http-client.js) which wires
these callbacks to the Pinia-based message store. Vanilla JS pages use
the default HttpClient with DOM-based Dialog fallback.

Architecture:
- fetch/http-client.js      - Generic HTTP client (no Koha knowledge)
- fetch/koha-api-client.js  - Base class: embed, CSRF, factory
- vue/fetch/http-client.js  - Vue subclass: Pinia store callbacks
- vue/fetch/api-client.js   - Sets factory, exports client singletons
- fetch/api-client.js       - Vanilla lazy-loading orchestrator

Test plan:
1. Apply patch
2. Run: yarn js:build
3. Run Cypress: run_cypress
4. Verify ERM, preservation, SIP2, ILL, acquisitions modules function
5. Verify vanilla JS pages (catalogue, circulation) still work
6. Sign off

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to