Bug 38993

Summary: Merge fetch files
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Architecture, internals, and plumbingAssignee: Jonathan Druart <jonathan.druart>
Status: Pushed to main --- QA Contact: Martin Renvoize (ashimema) <martin.renvoize>
Severity: enhancement    
Priority: P5 - low CC: m.de.rooy, martin.renvoize, matt.blenkinsop, paul.derscheid, pedro.amorim
Version: unspecified   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Technical notes: This change merge the 2 "fetch" directories. No more duplication of code which will make it more robust and maintainable.
Version(s) released in:
25.05.00
Circulation function:
Attachments: Bug 38993: Merge 'fetch' directories
Bug 38993: (follow-up) Add 'fetch' alias to rspack config
Bug 38993: (follow-up) Add 'fetch' alias to rspack config
Bug 38993: Merge 'fetch' directories
Bug 38993: (follow-up) Add 'fetch' alias to rspack config
Bug 38993: Use the @fetch alias
Bug 38993: Use the @fetch alias
Bug 38993: Restore add patrons to list
Bug 38993: Restore add patrons to list
Bug 38993: Merge 'fetch' directories
Bug 38993: (follow-up) Add 'fetch' alias to rspack config
Bug 38993: Use the @fetch alias
Bug 38993: Restore add patrons to list
Bug 38993: Merge 'fetch' directories
Bug 38993: (follow-up) Add 'fetch' alias to rspack config
Bug 38993: Use the @fetch alias
Bug 38993: Restore add patrons to list
Bug 38993: Merge 'fetch' directories
Bug 38993: (follow-up) Add 'fetch' alias to rspack config
Bug 38993: Use the @fetch alias
Bug 38993: Restore add patrons to list
Bug 38993: Fix sysprefs fetch from cypress
Bug 38993: Send CSRF token for Vue fetches

Description Jonathan Druart 2025-01-29 16:05:41 UTC
We have "fetch" files in koha-tmpl/intranet-tmpl/prog/js/vue/fetch and koha-tmpl/intranet-tmpl/prog/js/fetch
The reason is hidden behind http-client and how we handle errors.
We should avoid the duplication of -api-client.js files between the two directories.
Comment 1 Jonathan Druart 2025-01-29 16:06:18 UTC Comment hidden (obsolete)
Comment 2 Paul Derscheid 2025-01-29 16:35:55 UTC Comment hidden (obsolete)
Comment 3 Paul Derscheid 2025-01-29 16:46:58 UTC Comment hidden (obsolete)
Comment 4 Jonathan Druart 2025-01-30 08:16:29 UTC Comment hidden (obsolete)
Comment 5 Jonathan Druart 2025-01-30 08:16:32 UTC Comment hidden (obsolete)
Comment 6 Jonathan Druart 2025-01-30 08:16:34 UTC Comment hidden (obsolete)
Comment 7 Jonathan Druart 2025-01-30 08:56:41 UTC Comment hidden (obsolete)
Comment 8 Jonathan Druart 2025-01-30 09:06:31 UTC Comment hidden (obsolete)
Comment 9 Jonathan Druart 2025-01-30 09:15:07 UTC Comment hidden (obsolete)
Comment 10 Paul Derscheid 2025-01-30 09:24:19 UTC Comment hidden (obsolete)
Comment 11 Paul Derscheid 2025-01-30 09:24:22 UTC Comment hidden (obsolete)
Comment 12 Paul Derscheid 2025-01-30 09:24:24 UTC Comment hidden (obsolete)
Comment 13 Paul Derscheid 2025-01-30 09:24:27 UTC Comment hidden (obsolete)
Comment 14 Jonathan Druart 2025-01-30 09:36:47 UTC
We should then discuss how we want to organize those files.

One thing that is wrong is the inconsistency in the use of plural vs singular:
additional-fields-api-client.js
cover-image-api-client.js
patron-api-client.js

We first had the modules, and so started with singular. Then we continue with all singular. But at some point plurals got introduced and now it's messy.

I would revert to all singular, but that's for another bug report.
Comment 15 Jonathan Druart 2025-02-13 09:40:05 UTC
Rebased version of the patches on my gitlab repo: "bug_38993-rebased".

Will attach the patch here soon, but keeping for some auto-rebase tests.
Comment 16 Marcel de Rooy 2025-03-07 10:22:29 UTC
(In reply to Jonathan Druart from comment #15)
> Rebased version of the patches on my gitlab repo: "bug_38993-rebased".
> 
> Will attach the patch here soon, but keeping for some auto-rebase tests.

We are patient :)
Comment 17 Jonathan Druart 2025-03-10 12:05:31 UTC Comment hidden (obsolete)
Comment 18 Jonathan Druart 2025-03-10 12:05:34 UTC Comment hidden (obsolete)
Comment 19 Jonathan Druart 2025-03-10 12:05:36 UTC Comment hidden (obsolete)
Comment 20 Jonathan Druart 2025-03-10 12:05:39 UTC Comment hidden (obsolete)
Comment 21 Martin Renvoize (ashimema) 2025-03-10 12:13:37 UTC
Created attachment 179106 [details] [review]
Bug 38993: Merge 'fetch' directories

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 22 Martin Renvoize (ashimema) 2025-03-10 12:13:39 UTC
Created attachment 179107 [details] [review]
Bug 38993: (follow-up) Add 'fetch' alias to rspack config

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 23 Martin Renvoize (ashimema) 2025-03-10 12:13:42 UTC
Created attachment 179108 [details] [review]
Bug 38993: Use the @fetch alias

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 24 Martin Renvoize (ashimema) 2025-03-10 12:13:45 UTC
Created attachment 179109 [details] [review]
Bug 38993: Restore add patrons to list

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 25 Katrin Fischer 2025-03-17 10:48:03 UTC
Maybe a quick note about this for devs? (if it doesn't make sense, just refuse keyword)
Comment 26 Katrin Fischer 2025-03-17 11:03:03 UTC
Pushed for 25.05!

Well done everyone, thank you!
Comment 27 Jonathan Druart 2025-03-20 11:44:32 UTC
Created attachment 179513 [details] [review]
Bug 38993: Fix sysprefs fetch from cypress

Conflict between bug 38993 and bug 36025

We pass the token in the header, and retrieve it from the meta tag.
Comment 28 Katrin Fischer 2025-03-20 13:31:45 UTC
Pushed for 25.05!

Well done everyone, thank you!
Comment 29 Jonathan Druart 2025-03-20 15:40:15 UTC
Created attachment 179550 [details] [review]
Bug 38993: Send CSRF token for Vue fetches

We need it for syspref at least.
Comment 30 Katrin Fischer 2025-03-20 16:23:51 UTC
Pushed for 25.05!

Well done everyone, thank you!