[Koha-bugs] [Bug 32939] Have a generic fetch function for POST and PUT requests in vue modules

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Feb 14 10:12:51 CET 2023


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

--- Comment #3 from Jonathan Druart <jonathan.druart+koha at gmail.com> ---
I love it!

Some feedback:
1. a_id => prefer the full var name, agreement_id ;)

2. if ( this.$route.path.includes("edit") )

I don't really like this, I would prefer to rely on the status code (but I do
understand why you did that!). Imagine we have another form on this url, it
won't work in all cases.
Actually you don't need this, we know already if we are editing or adding
(search for "method", if there is agreement_id it's an edit). Note that there
is code that is no longer needed there (variable options, etc.)

3. I would add a "count" method in http-client

4. fetch/api-client.js is a too generic name, it should be tight to the "erm"
module. Don't you think? 

5. Looks like we don't need fetch/fetch.js? Was it expected?

6. There are things in http-client.js we are not using, we should remove them.

7. Instead of the async/await you add, shouldn't we prefer
client.agreements.(create).then(addMessage())?
Maybe it's only a matter of taste?

8. Code is not tidy, don't forget to install the pre-commit git hook!

I would like a version of this that is before bug 32925, then we added the
"isSubmitting info" there.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list